Bug 6107 – ICE(expression.c) when a non-template member named '__ctor' exists in a struct, and the constructor is attempted to be invoked.
Status
RESOLVED
Resolution
FIXED
Severity
trivial
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-06-05T00:52:00Z
Last change time
2015-06-17T21:01:57Z
Keywords
ice
Assigned to
nobody
Creator
kennytm
Comments
Comment #0 by kennytm — 2011-06-05T00:52:47Z
Test case:
----------------------------------
struct Foo {
enum __ctor = 4; // can also be a function, struct, alias, but template is ok.
}
void main() {
auto f = Foo("irrelevant"); // can also use 'new Foo(...)'
}
----------------------------------
Assertion failed: (td), function semantic, file expression.c, line 7040.
Abort trap
----------------------------------
Comment #1 by bugzilla — 2012-01-20T22:38:15Z
Names beginning with a double underscore are reserved for the compiler's use.
Comment #2 by andrej.mitrovich — 2013-01-10T07:14:02Z
(In reply to comment #1)
> Names beginning with a double underscore are reserved for the compiler's use.
Should we implement some kind of identifier checks in the front-end? We could gather all double-underscore symbols the compiler uses and just compare them when instantiating Identifier from user-code.
Unless the compiler also generates these symbols with random names, in such a case we would have to ban all double-underscores identifiers in user-code because they might potentially clash.