Bug 1627 – ICE with a method called _ctor

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2007-10-30T16:13:00Z
Last change time
2014-02-24T15:33:14Z
Keywords
ice-on-invalid-code
Assigned to
bugzilla
Creator
matti.niemenmaa+dbugzilla

Comments

Comment #0 by matti.niemenmaa+dbugzilla — 2007-10-30T16:13:23Z
class Foo { void _ctor() {} } void main() { Foo f = new Foo(); } asdf.d(2): function asdf.Foo._ctor expected to return a value of type int Assertion failure: 'member' on line 3208 in file 'expression.c' http://www.digitalmars.com/d/1.0/lex.html states that "[i]dentifiers starting with __ (two underscores) are reserved". This code probably fails because DMD uses the name _ctor for constructors. Either that should be __ctor or names starting with only one underscore should also be reserved. In any case, an ICE shouldn't result.
Comment #1 by matti.niemenmaa+dbugzilla — 2007-10-30T17:11:20Z
(In reply to comment #0) > asdf.d(2): function asdf.Foo._ctor expected to return a value of type int Oops! Disregard that, the code as posted doesn't result in that error message, only the ICE.
Comment #2 by matti.niemenmaa+dbugzilla — 2008-09-03T01:18:12Z
Changed in DMD 1.035 such that _ctor is reserved. A quick look doesn't give me anything in the docs about it but I'll leave this as a FIXED ice-on-invalid-code.
Comment #3 by bugzilla — 2008-09-03T01:33:15Z
Fixed dmd 1.035 and 2.019