Bug 4225 – mangle.c:81: char* mangle(Declaration*): Assertion `fd && fd->inferRetType' failed.

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2010-05-23T07:37:00Z
Last change time
2014-08-10T12:54:45Z
Keywords
rejects-valid
Assigned to
nobody
Creator
nfxjfg

Comments

Comment #0 by nfxjfg — 2010-05-23T07:37:44Z
$ cat bla.d struct Foo { const x = Foo(); static Foo opCall() { return Foo.init; } } $ dmd bla.d ::mangle(x) dmd: mangle.c:81: char* mangle(Declaration*): Assertion `fd && fd->inferRetType' failed. Aborted Tested with dmd 1.061, where I removed the commented printf() in mangle.c line 37.
Comment #1 by clugdbug — 2010-05-23T22:10:51Z
Probably related to bug 2080, since both involve type inference.
Comment #2 by bugzilla — 2011-04-10T21:16:38Z
A partial fix: https://github.com/D-Programming-Language/dmd/commit/1fc2fdb5fa9831eee2e1cae518ad350d517717c4 The error message is now: test.d(2): Error: cannot implicitly convert expression (opCall()) of type Foo to Foo
Comment #3 by yebblies — 2012-02-03T23:59:17Z
Compiles without error on D1 (1.072) Give a forward reference error with D2 (2.058) struct Foo { enum x = Foo(); static Foo opCall() { return Foo.init; } } testx.d(5): Error: forward reference to type Foo testx.d(5): Error: cannot implicitly convert expression (Foo()) of type Foo to Foo
Comment #4 by hsteoh — 2014-08-06T14:55:33Z
Seems to work now (compiles and runs with -main), though it does hit a deprecation warning: ----- test.d(2): Deprecation: variable test.Foo.x const field with initializer should be static, __gshared, or an enum -----
Comment #5 by hsteoh — 2014-08-06T14:56:26Z
P.S. This is on git HEAD (post 2.066).
Comment #6 by github-bugzilla — 2014-08-10T12:54:36Z
Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/c43a17582bdfb7c28980803c05663a5d09526557 fix Issue 4225 - forward reference of opCall (mangle.c:81: char* mangle(Declaration*): Assertion `fd && fd->inferRetType' failed.)