www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23570] New: UDAs do not carry over in foreach over tupleof

https://issues.dlang.org/show_bug.cgi?id=23570

          Issue ID: 23570
           Summary: UDAs do not carry over in foreach over tupleof
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: zorael gmail.com

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?

--
Dec 20 2022