Merge from mainline (165734:167278).
[official-gcc/graphite-test-results.git] / gcc / testsuite / g++.dg / abi / mangle34.C
blob08c3bc0a19b69c5a5b9b0f1a9a779e9a2b85f028
1 // Contributed by Dodji Seketeli <dodji@redhat.com>
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_" } }
9 struct Void {};
11 template <class R> struct FunType {
12   typedef R ResultType;
15 struct WrongNumberOfSigArgs {};
17 template <typename R> struct CFunType {
18   template <class Dummy1=Void, class Dummy2=Void> struct Sig : public
19 FunType<WrongNumberOfSigArgs> {};
20   template <class Dummy> struct Sig<Void,Dummy> : public FunType<R> {};
23 struct Dummy {
24   template <typename F> typename F::template Sig<>::ResultType operator()(F
25 const& f) const {
26     return typename F::template Sig<>::ResultType(0);
27   }
30 struct Gen: public CFunType<int> {
31   int operator()() const {return 0;}
32   Gen() {}
35 int myfunction() {
36   return Dummy()(Gen());
39 int main() {
40   myfunction();