digitalmars.D.bugs - [Issue 9048] New: Error: base classes expected instead of typeof when instantiating anonymous class
- d-bugmail puremagic.com (32/32) Nov 19 2012 http://d.puremagic.com/issues/show_bug.cgi?id=9048
- d-bugmail puremagic.com (15/15) Nov 19 2012 http://d.puremagic.com/issues/show_bug.cgi?id=9048
- d-bugmail puremagic.com (13/15) Nov 20 2012 http://d.puremagic.com/issues/show_bug.cgi?id=9048
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 puremagic.com ReportedBy: ogondza gmail.com --- Comment #0 from ogondza <ogondza 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: -------
Nov 19 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9048 timon.gehr gmx.ch changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |timon.gehr gmx.ch Severity|normal |enhancement --- Comment #1 from timon.gehr gmx.ch 2012-11-19 15:35:51 PST --- It is according to the language specification. It is the same parsing error as the one present in the following code: class C{} class D: typeof(new C){} This is an enhancement. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 19 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9048 Kenji Hara <k.hara.pg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |DUPLICATE --- Comment #2 from Kenji Hara <k.hara.pg gmail.com> 2012-11-20 19:48:17 PST --- (In reply to comment #0)new class typeof(this) {}; new class typeof(new Object()) {};Using typeof in base class list is allowed in 2.061head, by fixing issue 1353. *** This issue has been marked as a duplicate of issue 1353 *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 20 2012