Bug 5933 – Cannot retrieve the return type of an auto-return member function

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-05-06T02:19:00Z
Last change time
2013-01-24T21:08:19Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
kennytm

Comments

Comment #0 by kennytm — 2011-05-06T02:19:58Z
Test case: ------------------------------ struct X { auto x() { return 0; } } pragma(msg, typeof(X.init.x)); static assert(is(typeof(&X.init.x) == int delegate())); ------------------------------ () x.d(7): Error: static assert (is(typeof(__error) == int delegate())) is false ------------------------------ The expected output is 'int()' and the static assert should pass. The '__error' comes out because DMD thinks X.init.x is forward-referenced. This also causes a ICE when using with std.traits.ReturnType: ------------------------------ struct X { auto x() { return 0; } } static if (is(typeof(X.init.x) R == return)) {} ------------------------------ Assertion failed: (type), function AliasDeclaration, file declaration.c, line 376. Abort trap ------------------------------
Comment #1 by k.hara.pg — 2011-11-25T10:56:34Z
Comment #2 by robert — 2012-01-29T05:26:15Z
Comment #3 by k.hara.pg — 2012-09-15T06:42:01Z
*** Issue 8653 has been marked as a duplicate of this issue. ***
Comment #4 by github-bugzilla — 2012-11-19T17:55:32Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/5fa49c163dd294944c834e95676b9e71ed22ee82 fix Issue 5933 - Cannot retrieve the return type of an auto-return member function https://github.com/D-Programming-Language/dmd/commit/2ba68e1db6cf3b2d19dfe4d3f7909ee67948bad3 Merge pull request #535 from 9rnsr/fix5933 Issue 5933 & 7159 - Resolve forward reference to auto-return member function
Comment #5 by k.hara.pg — 2013-01-23T22:51:43Z
(In reply to comment #1) > https://github.com/D-Programming-Language/dmd/pull/535 That was a wrong change, and it had been reverted. A new pull request is: https://github.com/D-Programming-Language/dmd/pull/1543
Comment #6 by k.hara.pg — 2013-01-24T21:08:19Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/960987479e5c591c19e2a49c729c98a7f1218bd5 fix Issue 5933 - Cannot retrieve the return type of an auto-return member function https://github.com/D-Programming-Language/dmd/commit/de4f8f6bf8dc9fcc1730ea4d7f2bbd3e74880f08 Merge pull request #1543 from 9rnsr/fix5933 Issue 5933 & 7159 & 9377 - Invoke function semantic3 correctly where it is required.