p1.cpp revision ac373c4ca596a144d906570f284d46d702e10719
1// RUN: clang-cc -fsyntax-only -verify %s
2
3template<typename T, typename U> // expected-note{{previous template}}
4class X0 {
5public:
6  typedef int size_type;
7
8  X0(int);
9  ~X0();
10
11  void f0(const T&, const U&);
12
13  T& operator[](int i) const;
14
15  void f1(size_type) const;
16  void f2(size_type) const;
17  void f3(size_type) const;
18  void f4() ;
19
20  T value;
21};
22
23template<typename T, typename U>
24void X0<T, U>::f0(const T&, const U&) { // expected-note{{previous definition}}
25}
26
27template<class X, class Y>
28X& X0<X, Y>::operator[](int i) const {
29  (void)i;
30  return value;
31}
32
33template<class X, class Y>
34void X0<X, Y>::f1(int) const { }
35
36template<class X, class Y>
37void X0<X, Y>::f2(size_type) const { }
38
39template<class X, class Y, class Z> // expected-error{{too many template parameters}}
40void X0<X, Y>::f3(size_type) const {
41}
42
43template<class X, class Y>
44void X0<Y, X>::f4() { } // expected-error{{does not refer to}}
45
46// FIXME: error message should probably say, "redefinition of 'X0<T, U>::f0'"
47// rather than just "redefinition of 'f0'"
48template<typename T, typename U>
49void X0<T, U>::f0(const T&, const U&) { // expected-error{{redefinition}}
50}
51
52// Test out-of-line constructors, destructors
53template<typename T, typename U>
54X0<T, U>::X0(int x) : value(x) { }
55
56template<typename T, typename U>
57X0<T, U>::~X0() { }
58
59