[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / SemaTemplate / ms-class-specialization-class-scope.cpp
blobfc51c23a34e9107bc5dcc83df7115265492c18f8
1 // 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
4 class A {
5 public:
6 template<typename T> struct X { typedef int x; };
8 X<int>::x a; // expected-note {{implicit instantiation first required here}}
10 template<> struct X<int>; // expected-error {{explicit specialization of 'A::X<int>' after instantiation}}
11 template<> struct X<char>; // expected-note {{forward declaration}}
13 X<char>::x b; // expected-error {{incomplete type 'A::X<char>' named in nested name specifier}}
15 template<> struct X<double> {
16 typedef int y;
19 X<double>::y c;
21 template<> struct X<float> {}; // expected-note {{previous definition is here}}
22 template<> struct X<float> {}; // expected-error {{redefinition of 'X<float>'}}
25 A::X<void>::x axv;
26 A::X<float>::x axf; // expected-error {{no type named 'x'}}
28 template<class T> class B {
29 public:
30 template<typename U> struct X { typedef int x; };
32 typename X<int>::x a; // expected-note {{implicit instantiation first required here}}
34 template<> struct X<int>; // expected-error {{explicit specialization of 'X<int>' after instantiation}}
35 template<> struct X<char>; // expected-note {{forward declaration}}
37 typename X<char>::x b; // expected-error {{incomplete type 'B<float>::X<char>' named in nested name specifier}}
39 template<> struct X<double> {
40 typedef int y;
43 typename X<double>::y c;
45 template<> struct X<float> {}; // expected-note {{previous definition is here}}
46 template<> struct X<T> {}; // expected-error {{redefinition of 'X<float>'}}
49 B<float> b; // expected-note {{in instantiation of}}