Debian Codegraph @

gcc/testsuite/gdc.test/compilable/test24479.d

raw
1 // https://issues.dlang.org/show_bug.cgi?id=24479
2
3 /*
4 TEST_OUTPUT:
5 ---
6 1
7 2
8 ---
9 */
10
11 struct S
12 {
13 @1
14 S opBinary(string op: "-")(S rhs) const pure nothrow @nogc
15 {
16 return rhs;
17 }
18 @2
19 S opBinary(string op: "*")(S dur) const pure nothrow @nogc
20 {
21 return dur;
22 }
23 }
24
25 private enum hasExternalUDA(alias A) = is(A == External) || is(typeof(A) == External);
26
27 void foo()
28 {
29 static foreach (t; __traits(getOverloads, S, "opBinary", true))
30 static foreach(attr; __traits(getAttributes, t))
31 pragma(msg, attr);
32
33 static assert(__traits(getOverloads, S, "opBinary", true).length == 2);
34 alias A = __traits(getAttributes, __traits(getOverloads, S, "opBinary", true)[1]);
35 }