blob: fc51c23a34e9107bc5dcc83df7115265492c18f8 [file] [log] [blame]
Richard Smith8a0dde72013-12-14 01:04:22 +00001// RUN: %clang_cc1 -fms-extensions -fsyntax-only -verify %s -Wno-microsoft
2// RUN: %clang_cc1 -fms-extensions -fdelayed-template-parsing -fsyntax-only -verify %s -Wno-microsoft
3
4class A {
5public:
6 template<typename T> struct X { typedef int x; };
7
8 X<int>::x a; // expected-note {{implicit instantiation first required here}}
9
10 template<> struct X<int>; // expected-error {{explicit specialization of 'A::X<int>' after instantiation}}
11 template<> struct X<char>; // expected-note {{forward declaration}}
12
13 X<char>::x b; // expected-error {{incomplete type 'A::X<char>' named in nested name specifier}}
14
15 template<> struct X<double> {
16 typedef int y;
17 };
18
19 X<double>::y c;
20
21 template<> struct X<float> {}; // expected-note {{previous definition is here}}
Richard Smith792c22d2016-12-24 04:09:05 +000022 template<> struct X<float> {}; // expected-error {{redefinition of 'X<float>'}}
Richard Smith8a0dde72013-12-14 01:04:22 +000023};
24
25A::X<void>::x axv;
26A::X<float>::x axf; // expected-error {{no type named 'x'}}
27
28template<class T> class B {
29public:
30 template<typename U> struct X { typedef int x; };
31
32 typename X<int>::x a; // expected-note {{implicit instantiation first required here}}
33
34 template<> struct X<int>; // expected-error {{explicit specialization of 'X<int>' after instantiation}}
35 template<> struct X<char>; // expected-note {{forward declaration}}
36
37 typename X<char>::x b; // expected-error {{incomplete type 'B<float>::X<char>' named in nested name specifier}}
38
39 template<> struct X<double> {
40 typedef int y;
41 };
42
43 typename X<double>::y c;
44
45 template<> struct X<float> {}; // expected-note {{previous definition is here}}
46 template<> struct X<T> {}; // expected-error {{redefinition of 'X<float>'}}
47};
48
49B<float> b; // expected-note {{in instantiation of}}