| 1 |
module trait_loc_ov_err; |
| 2 |
/* |
| 3 |
TEST_OUTPUT: |
| 4 |
--- |
| 5 |
fail_compilation/trait_loc_ov_err.d(24): Error: cannot get location of an overload set, use `__traits(getOverloads, ..., "ov1")[N]` to get the Nth overload |
| 6 |
fail_compilation/trait_loc_ov_err.d(25): Error: cannot get location of an overload set, use `__traits(getOverloads, ..., "ov2")[N]` to get the Nth overload |
| 7 |
--- |
| 8 |
*/ |
| 9 |
|
| 10 |
void ov1(){} |
| 11 |
void ov1(int){} |
| 12 |
|
| 13 |
void ov21(){} |
| 14 |
void ov22(int){} |
| 15 |
alias ov2 = ov21; |
| 16 |
alias ov2 = ov22; |
| 17 |
|
| 18 |
template OvT(T, U){} |
| 19 |
template OvT(T){} |
| 20 |
|
| 21 |
auto func(T)(T t) {} |
| 22 |
auto func(T,U)(T t,U u) {} |
| 23 |
|
| 24 |
enum e1 = __traits(getLocation, ov1); |
| 25 |
enum e2 = __traits(getLocation, ov2); |
| 26 |
|
| 27 |
enum e3 = __traits(getLocation, OvT); |
| 28 |
enum e4 = __traits(getLocation, func); |
| 29 |
|
| 30 |
enum e5 = __traits(getLocation, __traits(getOverloads, trait_loc_ov_err, "ov1")[0]); |
| 31 |
enum e6 = __traits(getLocation, __traits(getOverloads, trait_loc_ov_err, "ov1")[1]); |
| 32 |
|
| 33 |
enum e7 = __traits(getLocation, __traits(getOverloads, trait_loc_ov_err, "ov2")[0]); |
| 34 |
enum e8 = __traits(getLocation, __traits(getOverloads, trait_loc_ov_err, "ov2")[1]); |
| 35 |
|
| 36 |
enum e9 = __traits(getLocation, __traits(getOverloads, trait_loc_ov_err, "OvT", true)[1]); |
| 37 |
enum e10 = __traits(getLocation, __traits(getOverloads, trait_loc_ov_err, "OvT", true)[0]); |
| 38 |
|
| 39 |
enum e11 = __traits(getLocation, __traits(getOverloads, trait_loc_ov_err, "func", true)[0]); |
| 40 |
enum e12 = __traits(getLocation, __traits(getOverloads, trait_loc_ov_err, "func", true)[1]); |