Bug 22711 – Effect of template UDAs on instance members is undocumented

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dlang.org
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-01-28T20:54:01Z
Last change time
2022-01-28T21:42:35Z
Keywords
pull
Assigned to
No Owner
Creator
Paul Backus

Comments

Comment #0 by snarwin+bugzilla — 2022-01-28T20:54:01Z
When a UDA is attached to a template declaration, and that template is instantiated, the UDA is automatically attached to each of that template instance's direct members: --- @("uda") template Example(T) { struct S { int x; } int n; void fun() {}; } import std.traits: hasUDA; static assert(hasUDA!(Example!int.S, "uda")); static assert(hasUDA!(Example!int.n, "uda")); static assert(hasUDA!(Example!int.fun, "uda")); // does not apply to members of members static assert(!hasUDA!(Example!int.S.x, "uda")); --- However, this behavior is not documented in the language spec.
Comment #1 by dlang-bot — 2022-01-28T21:07:05Z
@pbackus created dlang/dlang.org pull request #3195 "Fix issue 22711 - Effect of template UDAs on instance members is undo…" fixing this issue: - Fix issue 22711 - Effect of template UDAs on instance members is undocumented https://github.com/dlang/dlang.org/pull/3195
Comment #2 by dlang-bot — 2022-01-28T21:42:35Z
dlang/dlang.org pull request #3195 "Fix issue 22711 - Effect of template UDAs on instance members is undo…" was merged into master: - 1f116ddfb1b4fa3a067f241a6558740e65d7cc01 by Paul Backus: Fix issue 22711 - Effect of template UDAs on instance members is undocumented https://github.com/dlang/dlang.org/pull/3195