Debian Codegraph @

gcc/testsuite/g++.dg/abi/mangle34.C

raw
1 // Contributed by Dodji Seketeli <[email protected]>
2 // Origin PR c++/40808
3 // { dg-do compile }
4 // This tests the mangling of empty template argument list in a template
5 // id.
6 // { dg-final { scan-assembler "_ZNK5DummyclI3GenEENT_3SigIE10ResultTypeERKS2_" } }
7 // { dg-additional-options -fabi-compat-version=0 }
8
9
10 struct Void {};
11
12 template <class R> struct FunType {
13 typedef R ResultType;
14 };
15
16 struct WrongNumberOfSigArgs {};
17
18 template <typename R> struct CFunType {
19 template <class Dummy1=Void, class Dummy2=Void> struct Sig : public
20 FunType<WrongNumberOfSigArgs> {};
21 template <class Dummy> struct Sig<Void,Dummy> : public FunType<R> {};
22 };
23
24 struct Dummy {
25 template <typename F> typename F::template Sig<>::ResultType operator()(F
26 const& f) const {
27 return typename F::template Sig<>::ResultType(0);
28 }
29 };
30
31 struct Gen: public CFunType<int> {
32 int operator()() const {return 0;}
33 Gen() {}
34 };
35
36 int myfunction() {
37 return Dummy()(Gen());
38 }
39
40 int main() {
41 myfunction();
42 }