Bug 15804 – missing UDAs on nested struct template
Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-03-17T07:28:37Z
Last change time
2021-11-13T03:37:19Z
Keywords
pull
Assigned to
No Owner
Creator
Adrian Matoga
Comments
Comment #0 by adrian — 2016-03-17T07:28:37Z
Code:
@(42) struct Foo(D) {}
auto fooFac(T)()
{
pragma(msg, __traits(getAttributes, Foo));
return Foo!T();
}
auto booFac(T)()
{
@(43) struct Boo {}
pragma(msg, __traits(getAttributes, Boo));
return Boo();
}
auto barFac(T)()
{
@(44) struct Bar(D) {}
pragma(msg, __traits(getAttributes, Bar));
return Bar!T();
}
auto bazFac(T)()
{
@(45) static struct Baz(D) {}
pragma(msg, __traits(getAttributes, Baz));
return Baz!T();
}
void main()
{
auto foo = fooFac!int;
auto boo = booFac!int;
auto bar = barFac!int;
auto baz = bazFac!int;
}
Compilation produces:
tuple(42)
tuple(43)
tuple()
tuple()
Expected:
tuple(42)
tuple(43)
tuple(44)
tuple(45)
Comment #1 by john.loughran.colvin — 2017-11-10T16:58:29Z
the same happens for nested function templates
Comment #2 by dlang-bot — 2021-11-12T08:55:39Z
@BorisCarvajal created dlang/dmd pull request #13292 "Fix Issue 15804 - missing UDAs on nested struct template" fixing this issue:
- Fix Issue 15804 - missing UDAs on nested struct template
Local function symbols get UDAs by the scope during semantic.
Since there is no setScope() call on them.
Adding the required logic for TemplateDeclaration too.
https://github.com/dlang/dmd/pull/13292
Comment #3 by dlang-bot — 2021-11-13T03:37:19Z
dlang/dmd pull request #13292 "Fix Issue 15804 - missing UDAs on nested struct template" was merged into master:
- b50797a696e7a7c25e06fd831ca7bdc31f24ec6f by Boris Carvajal:
Fix Issue 15804 - missing UDAs on nested struct template
Local function symbols get UDAs by the scope during semantic.
Since there is no setScope() call on them.
Adding the required logic for TemplateDeclaration too.
https://github.com/dlang/dmd/pull/13292