• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 struct X0 {
3   X0 f1();
4   X0 f2();
5 };
6 
7 template<typename T>
8 struct X1 {
9   X1<T>(int);
10   (X1<T>)(float);
11   X1 f2();
12   X1 f2(int);
13   X1 f2(float);
14 };
15 
16 // Error recovery: out-of-line constructors whose names have template arguments.
X1(int)17 template<typename T> X1<T>::X1<T>(int) { } // expected-error{{out-of-line constructor for 'X1' cannot have template arguments}}
18 template<typename T> (X1<T>::X1<T>)(float) { } // expected-error{{out-of-line constructor for 'X1' cannot have template arguments}}
19 
20 // Error recovery: out-of-line constructor names intended to be types
f1()21 X0::X0 X0::f1() { return X0(); } // expected-error{{qualified reference to 'X0' is a constructor name rather than a type wherever a constructor can be declared}}
22 
f2()23 struct X0::X0 X0::f2() { return X0(); }
24 
f2()25 template<typename T> X1<T>::X1<T> X1<T>::f2() { } // expected-error{{qualified reference to 'X1' is a constructor name rather than a template name wherever a constructor can be declared}}
X1(X1<T>::f2)26 template<typename T> X1<T>::X1<T> (X1<T>::f2)(int) { } // expected-error{{qualified reference to 'X1' is a constructor name rather than a template name wherever a constructor can be declared}}
X1(X1<T>::f2)27 template<typename T> struct X1<T>::X1<T> (X1<T>::f2)(float) { }
28