Bug 22694 – template mixin with UDA not recognized inside function

Status
NEW
Severity
minor
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-01-21T10:18:35Z
Last change time
2024-12-13T19:20:31Z
Assigned to
No Owner
Creator
Harry Vennik
Moved to GitHub: dmd#18079 →

Comments

Comment #0 by htvennik — 2022-01-21T10:18:35Z
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.
Comment #1 by jlourenco5691 — 2022-01-21T20:45:45Z
Not just inside function blocks, but unittest blocks too.
Comment #2 by robert.schadek — 2024-12-13T19:20:31Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18079 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB