[Issue 9048] New: Error: base classes expected instead of typeof when instantiating anonymous class

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Nov 19 15:18:46 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=9048

           Summary: Error: base classes expected instead of typeof when
                    instantiating anonymous class
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: ogondza at gmail.com


--- Comment #0 from ogondza <ogondza at gmail.com> 2012-11-19 15:18:45 PST ---
Unlike, regular classes, anonymous classes seems to be impossible to
instantiate when using typeof expression.

This works perfectly:

  new typeof(this)();
  new typeof(new Object())();

But these

  new class typeof(this) {};
  new class typeof(new Object()) {};

give (on v2.060)

  Error: base classes expected instead of typeof
  Error: { members } expected for anonymous class
  Error: found 'typeof' when expecting ';' following statement

It can be worked around aliasing the type first and then instantiating
anonymous class of the aliased type. However, for an anonymous class it is
necessary to instantiate in one expression.

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


More information about the Digitalmars-d-bugs mailing list