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