https://d.puremagic.com/issues/show_bug.cgi?id=11795
Summary: DMD allows nested new operator syntax together with
anonymous classes
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: [email protected]
ReportedBy: [email protected]
--- Comment #0 from Bruno Medeiros <[email protected]> 2013-12-21
16:18:17 PST ---
It seems DMD syntactically allows the new operator nested class instantiation
syntax together with the anonymous class syntax, like this:
auto outer = new Outer();
outer.new class Inner { };
This syntax never makes sense, because an anonymous class instantiation always
defines an outer context by itself (by means of the surrounding scope), so it
cannot have another outer scope (ie, the outer class). Using this syntax will
always result in a semantic error, or some compiler internal error. For example
the following code compiles without semantic errors, but the linker fails:
class Outer {
int foo;
auto x = new Outer().new class Inner {};
class Inner {
}
}
void main() {
}
--
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------