Manjaro/Arch x86_64, dmd 2.101.0
---
import std;
enum UDA;
struct Foo
{
@UDA int i;
}
void main()
{
Foo f;
foreach (i, ref symbol; f.tupleof)
{
static assert(hasUDA!(symbol, UDA)); // fails
static assert(hasUDA!(f.tupleof[i], UDA)); // succeeds
}
}
---
I understand that it currently doesn't, but shouldn't it?
Comment #1 by razvan.nitu1305 — 2022-12-20T13:15:33Z
I don't think this can be "fixed". The problem is that the foreach is technically a runtime construct, therefore, the compiler sees `i` and `symbol` as runtime variables. I'm not sure if this can be fixed, looking into it.
Comment #2 by robert.schadek — 2024-12-13T19:26:26Z