digitalmars.D.bugs - [Issue 22694] New: template mixin with UDA not recognized inside
- d-bugmail puremagic.com (56/56) Jan 21 2022 https://issues.dlang.org/show_bug.cgi?id=22694
https://issues.dlang.org/show_bug.cgi?id=22694 Issue ID: 22694 Summary: template mixin with UDA not recognized inside function Product: D Version: D2 Hardware: All URL: http://dlang.org/ OS: All Status: NEW Severity: minor Priority: P3 Component: dmd Assignee: nobody puremagic.com Reporter: htvennik gmail.com Given the following declarations ------------------ mixin template Foo(T) { struct S { T a; } } enum myUda; ------------------ The following code does not compile: ------------------ int main() { myUda mixin Foo!int; auto s = S(0); return s.a; } ------------------ Error: found `Foo` when expecting `(` following `mixin` However, the following two snippets compile successfully: ------------------ int main() { mixin Foo!int; auto s = S(0); return s.a; } ------------------ myUda mixin Foo!int; int main() { auto s = S(0); return s.a; } ------------------ Looks like dmd fails to recognize a template mixin inside a function when it has an UDA applied to it. --
Jan 21 2022