Bug 8972 – __traits fails in a struct member function

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-11-07T08:46:00Z
Last change time
2012-11-30T21:22:12Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
samukha
Depends on
9100

Comments

Comment #0 by samukha — 2012-11-07T08:46:46Z
struct A { void foo() {} void connect() { foreach (overload; __traits(getOverloads, typeof(this), "foo")) { } } } Error: variable test.A.connect.overload cannot be declared to be a function
Comment #1 by samukha — 2012-11-07T19:19:12Z
Changed the title since the bug is not specific to foreach or getOverloads. Related to http://d.puremagic.com/issues/show_bug.cgi?id=8971 Another test case: template Tuple(A...) { alias A Tuple; } struct A { void foo() {} void connect() { alias Tuple!(__traits(getOverloads, typeof(this), "foo")) overloads; } } Error: expression this.foo is not a valid template value argument
Comment #2 by k.hara.pg — 2012-11-08T05:04:27Z
The bug cause is same as bug 8771, so this is also a regression. https://github.com/D-Programming-Language/dmd/pull/1268 Max, thanks to your report. When I fixed bug 8971, I had completely forgotten the case for struct member function.
Comment #3 by samukha — 2012-11-08T05:33:01Z
No problem. Thanks for your efforts.
Comment #4 by github-bugzilla — 2012-11-08T07:17:32Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/66756c6d2d109680682b61e0e2c8e6de6215f960 fix Issue 8972 - __traits fails in a struct member function https://github.com/D-Programming-Language/dmd/commit/7d39d577ab0120d64a073c2513d966c8a150f022 Merge pull request #1268 from 9rnsr/fix8972 Issue 8972 - __traits fails in a struct member function