getOverloads order
Dennis
dkorpel at gmail.com
Thu Jul 13 10:53:49 UTC 2023
On Thursday, 13 July 2023 at 08:03:02 UTC, IchorDev wrote:
> I've noticed that `__traits(getOverloads)` always returns the
> overloads in lexical order across DMD, LDC, and GDC. Is this
> reliable at all?
No. It depends on the order the compiler analyzes the symbols,
which is often lexical order, but it can vary based on static if,
mixin, forward references etc. Here's a counter example:
```D
void f(int x);
mixin("void f(float y);");
void f(char z);
```
Here you get overloads of `f` in the order (x, z, y) instead of
(x, y, z).
More information about the Digitalmars-d-learn
mailing list