www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23855] New: traits getOverloads returns overload when one of

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

          Issue ID: 23855
           Summary: traits getOverloads returns overload when one of the
                    symbols is a templatized function
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: default_357-line yahoo.de



```
void test()() { }
void test(int) { }

void main() {
    alias thisModule = __traits(parent, main);
    alias overloads = __traits(getOverloads, thisModule, "test");
    pragma(msg, overloads.length); // returns 1
    static foreach (member; overloads) {
        alias udas = __traits(getAttributes, member);
    }
}
```

Leads to

```
Deprecation: `__traits(getAttributes)` may only be used for individual
functions, not overload sets such as: `test`
       the result of `__traits(getOverloads)` may be used to select the desired
function to extract attributes from
```

Ie. despite two symbols existing, __traits(getOverloads) returns the combined
overload set. And for once, it's independent of order too.

--
Apr 24 2023