Chandler Carruth | b7de181 | 2010-01-31 07:24:03 +0000 | [diff] [blame] | 1 | // 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 | |
| 10 | template <typename T> struct X0 { |
| 11 | X0(); |
| 12 | ~X0(); |
| 13 | X0 f(const X0&); |
| 14 | }; |
| 15 | |
| 16 | // Test non-type template parameters. |
| 17 | template <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 | |
| 28 | int i = 42; |
Chandler Carruth | b7de181 | 2010-01-31 07:24:03 +0000 | [diff] [blame] | 29 | void test() { |
| 30 | X0<int> x0; (void)x0; |
Douglas Gregor | b7a0926 | 2010-04-01 18:32:35 +0000 | [diff] [blame] | 31 | X1<42, i, &i> x1; (void)x1; |
Chandler Carruth | b7de181 | 2010-01-31 07:24:03 +0000 | [diff] [blame] | 32 | } |