blob: e936640f5e3e489c8886ebba6567026cb812c075 [file] [log] [blame]
John Thompsonb3eca292009-10-27 14:31:53 +00001// RUN: clang-cc -fsyntax-only -verify -fms-extensions=0 %s
Douglas Gregor39a8de12009-02-25 19:37:18 +00002
3namespace N {
4 namespace M {
Chris Lattnerf4382f52009-04-14 22:17:06 +00005 template<typename T> struct Promote;
Douglas Gregor39a8de12009-02-25 19:37:18 +00006
7 template<> struct Promote<short> {
8 typedef int type;
9 };
10
11 template<> struct Promote<int> {
12 typedef int type;
13 };
14
15 template<> struct Promote<float> {
16 typedef double type;
17 };
18
19 Promote<short>::type *ret_intptr(int* ip) { return ip; }
20 Promote<int>::type *ret_intptr2(int* ip) { return ip; }
21 }
22
23 M::Promote<int>::type *ret_intptr3(int* ip) { return ip; }
24 M::template Promote<int>::type *ret_intptr4(int* ip) { return ip; }
25}
26
27N::M::Promote<int>::type *ret_intptr5(int* ip) { return ip; }
28::N::M::Promote<int>::type *ret_intptr6(int* ip) { return ip; }
29
30
Douglas Gregor7bb87fc2009-11-11 16:39:34 +000031N::M::template; // expected-error{{expected unqualified-id}}
32N::M::template Promote; // expected-error{{expected unqualified-id}}
Douglas Gregor39a8de12009-02-25 19:37:18 +000033
34namespace N {
35 template<typename T> struct A;
36
37 template<>
38 struct A<int> {
39 struct X;
40 };
Douglas Gregorc45c2322009-03-31 00:43:58 +000041
42 struct B;
Douglas Gregor39a8de12009-02-25 19:37:18 +000043}
44
45struct ::N::A<int>::X {
46 int foo;
47};
Douglas Gregorc45c2322009-03-31 00:43:58 +000048
Douglas Gregorc45c2322009-03-31 00:43:58 +000049template<typename T>
50struct TestA {
Douglas Gregor7bb87fc2009-11-11 16:39:34 +000051 typedef typename N::template B<T>::type type; // expected-error{{'B' following the 'template' keyword does not refer to a template}} \
52 // expected-error{{identifier or template-id}} \
53 // expected-error{{expected member name}}
Douglas Gregorc45c2322009-03-31 00:43:58 +000054};