www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3640] New: shared this() constructor does not work and reports strange errors without line numbers

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3640

           Summary: shared this() constructor does not work and reports
                    strange errors without line numbers
           Product: D
           Version: 2.036
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: jason.james.house gmail.com



17:23:33 PST ---
Sample code:
=================================
class foo{
  shared this(){}
}
void main(){
  auto x = new shared(foo)();
}
=================================

Result with dmd 2.037
(bug report lists 2.036, but that's because 2.037 was not an option at the
time)

$ dmd test.d
Error: cannot implicitly convert expression (this) of type shared(foo) to
test.foo


I have no idea what inspired me to originally try this variation of a
constructor since dropping the shared keyword results in code that compiles. 
Moving the shared keyword after the constructor declaration (AKA this()
shared{}) results in a parse error.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 23 2009
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3640


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |yebblies gmail.com
         Resolution|                            |FIXED



This code compiles and runs with no errors on dmd 2.053

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 09 2011