Bug 20093 – __traits(getAttributes) Error: cannot form tuple of tuples

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
All
Creation time
2019-07-31T22:53:06Z
Last change time
2020-06-05T08:56:04Z
Assigned to
No Owner
Creator
Adam D. Ruppe

Comments

Comment #0 by destructionator — 2019-07-31T22:53:06Z
mixin template MakeProperty(Attributes...) { @(Attributes) void bug() {} } struct Attr { } struct Test { mixin MakeProperty!(Attr); } void main() { pragma(msg, __traits(getAttributes, Test.bug).stringof); } ------ Interestingly, it compiles fine if you do not try to actually getAttributes; comment out that pragma line in main and it works just fine. It also works if you pass a value to MakeProperty; only a type like in the example triggers the problem. In dmd, the comment says "Assume exps[] is already tuple expanded." so I'm guessing some semantic() pass wasn't run in the right place for this.
Comment #1 by destructionator — 2019-07-31T22:56:05Z
I'll also note that `@(Attr) void foo()` is perfectly acceptable D code; to trigger this bug you do have to go through the mixin template or some other way of creating a TypeTuple. My expected behavior is that it expands the Attributes tuple inside the @() just like it would anywhere else, even if it has that type arg instead of just values.
Comment #2 by boris2.9 — 2020-05-19T10:45:46Z
*** This issue has been marked as a duplicate of issue 19728 ***
Comment #3 by dlang-bot — 2020-05-24T23:49:14Z
dlang/dmd pull request #11160 "Fix Issues 19728, 20093 - AliasSeq in UDA errors" was merged into stable: - 3ae76de5a11379fcd137106ffaf5caaa3325f698 by Boris Carvajal: Fix Issues 19728, 20093 - AliasSeq in UDA errors https://github.com/dlang/dmd/pull/11160