January 21, 2022 [Issue 22694] New: template mixin with UDA not recognized inside function | ||||
|---|---|---|---|---|
| ||||
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. -- | ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply