p1.cpp revision 8e8fb3be5bd78f0564444eca02b404566a5f3b5d
1// RUN: %clang_cc1 -fsyntax-only -verify %s
2// expected-no-diagnostics
3
4// C++0x [temp.local]p1:
5//   Like normal (non-template) classes, class templates have an
6//   injected-class-name (Clause 9). The injected-class-name can be used with
7//   or without a template-argument-list. When it is used without
8//   a template-argument-list, it is equivalent to the injected-class-name
9//   followed by the template-parameters of the class template enclosed in <>.
10
11template <typename T> struct X0 {
12  X0();
13  ~X0();
14  X0 f(const X0&);
15};
16
17// Test non-type template parameters.
18template <int N1, const int& N2, const int* N3> struct X1 {
19  X1();
20  ~X1();
21  X1 f(const X1& x1a) { X1 x1b(x1a); return x1b; }
22};
23
24//   When it is used with a template-argument-list, it refers to the specified
25//   class template specialization, which could be the current specialization
26//   or another specialization.
27// FIXME: Test this clause.
28
29int i = 42;
30void test() {
31  X0<int> x0; (void)x0;
32  X1<42, i, &i> x1; (void)x1;
33}
34