Bug 10587 – __traits(getAttributes) doesn't work on incomplete templated types
Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-07-09T11:38:30Z
Last change time
2020-05-24T14:33:10Z
Assigned to
No Owner
Creator
QAston
Comments
Comment #0 by qaston — 2013-07-09T11:38:30Z
Minimized case:
enum Attribute;
@Attribute
class MyTemplate(T) {
}
@Attribute
class MyType {
}
pragma(msg, __traits(getAttributes, MyTemplate)); // prints: tuple()
pragma(msg, __traits(getAttributes, MyTemplate!uint)); // prints: tuple((Attribute))
pragma(msg, __traits(getAttributes, MyType)); // prints: tuple((Attribute))
I think it either result should be the same for non-instantiated type as for instantiated or pragma(msg, __traits(getAttributes, MyTemplate)) should yeld a compile time error.