[Issue 20686] New: type of tuple is lost?

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Mar 19 20:22:48 UTC 2020


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

          Issue ID: 20686
           Summary: type of tuple is lost?
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: rejects-valid
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: elpenguino+D at gmail.com

```
struct El(T) {
    long x;
    void f2() {
        f("");
    }
    void f(T2)(T2) {
        static assert(getSymbolsByUDA!(El!T, AliasSeq!("x", "f2")).length > 0);
    }
}
alias X = El!int;
void main() {
        X().f((char[]).init);
}

private template getSymbolsByUDA(alias symbol, names...)
{
    static if (names.length == 0)
    {
        alias getSymbolsByUDA = AliasSeq!();
    }
    else
    {
        alias getSymbolsByUDA = AliasSeq!(__traits(getMember, symbol,
names[0]), getSymbolsByUDA!(symbol, names[1 .. $]));
    }
}
template AliasSeq(TList...)
{
    alias AliasSeq = TList;
}
```

Currently, in DMD 2.091, compiling this results in this error:
```
onlineapp.d(7): Error: no property length for type void
onlineapp.d(7):        while evaluating: static
assert(getSymbolsByUDAImpl!(El!int, "f", "f2").length > 0)
```
I'm not entirely sure what's going on here. This reduced getSymbolsByUDA
implementation will always return a tuple and should never be void...

This specific error seems to have been introduced with DMD 2.066. Last compiled
successfully in DMD 2.062.

--


More information about the Digitalmars-d-bugs mailing list