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_" } } 7 8 9 struct Void {}; 10 11 template <class R> struct FunType { 12 typedef R ResultType; 13 }; 14 15 struct WrongNumberOfSigArgs {}; 16 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> {}; 21 }; 22 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 } 28 }; 29 30 struct Gen: public CFunType<int> { 31 int operator()() const {return 0;} 32 Gen() {} 33 }; 34 35 int myfunction() { 36 return Dummy()(Gen()); 37 } 38 39 int main() { 40 myfunction(); 41 } 42