Debian Codegraph @

gcc/testsuite/g++.dg/abi/abi-tag21.C

raw
1 // { dg-do compile { target c++11 } }
2 // { dg-options -Wabi=10 }
3
4 struct [[gnu::abi_tag ("foo")]] A
5 {
6 template <class T> static T f();
7 template <class T> static A g();
8 };
9
10 template <class T> struct B
11 {
12 static decltype(A::f<T>()) fa(decltype(A::f<T>()));
13 static decltype(A::f<T>()) fv(); // { dg-warning "mangled name" }
14 static decltype(A::g<T>()) ga(decltype(A::g<T>()));
15 static decltype(A::g<T>()) gv();
16 template <class U>
17 static decltype(A::f<U>()) hv();
18 };
19
20 int main()
21 {
22 B<int>::fa(0); // { dg-final { scan-assembler "_ZN1BIiE2faEi" } }
23 B<int>::fv(); // { dg-final { scan-assembler "_ZN1BIiE2fvEv" } }
24 B<int>::ga(A()); // { dg-final { scan-assembler "_ZN1BIiE2gaE1AB3foo" } }
25 B<int>::gv(); // { dg-final { scan-assembler "_ZN1BIiE2gvB3fooEv" } }
26 B<int>::hv<int>(); // { dg-final { scan-assembler "_ZN1BIiE2hvIiEEDTclsr1AB3foo1fIT_EEEv" } }
27 }