Bug 18314 – std.traits.getSymbolsByUDA only considers the first symbol of an overload set
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
All
Creation time
2018-01-27T14:00:31Z
Last change time
2018-03-23T09:38:33Z
Keywords
pull
Assigned to
No Owner
Creator
Dechcaudron
Comments
Comment #0 by dechcaudron+issues.dlang — 2018-01-27T14:00:31Z
Consider the following code:
```
enum lol;
enum lal;
struct A
{
@lal
void foo();
@lol
void foo(int a);
}
void main()
{
pragma(msg, "Tagged with @lal:");
static foreach(alias member; getSymbolsByUDA!(A, lal))
{
pragma(msg, __traits(identifier, member));
}
pragma(msg, "Tagged with @lol:");
static foreach(alias member; getSymbolsByUDA!(A, lol))
{
pragma(msg, __traits(identifier, member));
}
}
```
When building, `foo` only shows up in the first foreach, not in the second one.
Comment #1 by simen.kjaras — 2018-01-28T01:59:19Z
*** This issue has been marked as a duplicate of issue 17941 ***
Comment #2 by simen.kjaras — 2018-01-28T15:17:12Z
Actually, I was wrong here. While the root issue is the same, the way getSymbolsByUDA works should make it possible to fix it without addressing the issues in bug 17941. Fixed in this PR:
https://github.com/dlang/phobos/pull/6085
Comment #3 by github-bugzilla — 2018-02-01T13:15:27Z