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