← Back to index
|
Original Bugzilla link
Bug 21790 – Finding template UDAs is not possible
Status
NEW
Severity
normal
Priority
P3
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2021-04-02T14:08:00Z
Last change time
2024-12-01T16:38:39Z
Assigned to
No Owner
Creator
Eyal
Moved to GitHub: phobos#9820 →
Comments
Comment #0
by eyal — 2021-04-02T14:08:00Z
import std.traits: hasUDA, getUDAs; struct uda(T) {} @uda int var; static assert(hasUDA!(var, uda)); // fails static assert(getUDAs!(var, uda).length == 1); // fails static assert(is(getUDAs!(var, uda)[0] == uda)); // fails
Comment #1
by johan_forsberg_86 — 2021-04-02T18:32:36Z
What scope did you run that in? Also, should udas be able to be templated like that? Wouldn't you have to do @uda!int and uda!int for example? 🤔
Comment #2
by eyal — 2021-04-02T19:52:24Z
UDAs are quite flexible. Can be pretty much anything. With @uda!int (or any type rather than a template) it will work.
Comment #3
by robert.schadek — 2024-12-01T16:38:39Z
THIS ISSUE HAS BEEN MOVED TO GITHUB
https://github.com/dlang/phobos/issues/9820
DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB