summaryrefslogtreecommitdiffstats
path: root/test/SemaTemplate/ms-class-specialization-class-scope.cpp
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2013-12-22 00:07:40 +0000
committerdim <dim@FreeBSD.org>2013-12-22 00:07:40 +0000
commit952eddef9aff85b1e92626e89baaf7a360e2ac85 (patch)
treedf8df0b0067b381eab470a3b8f28d14a552a6340 /test/SemaTemplate/ms-class-specialization-class-scope.cpp
parentea266cad53e3d49771fa38103913d3ec7a166694 (diff)
downloadFreeBSD-src-952eddef9aff85b1e92626e89baaf7a360e2ac85.zip
FreeBSD-src-952eddef9aff85b1e92626e89baaf7a360e2ac85.tar.gz
Vendor import of clang release_34 branch r197841 (effectively, 3.4 RC3):
https://llvm.org/svn/llvm-project/cfe/branches/release_34@197841
Diffstat (limited to 'test/SemaTemplate/ms-class-specialization-class-scope.cpp')
-rw-r--r--test/SemaTemplate/ms-class-specialization-class-scope.cpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/test/SemaTemplate/ms-class-specialization-class-scope.cpp b/test/SemaTemplate/ms-class-specialization-class-scope.cpp
new file mode 100644
index 0000000..3ebb1c9
--- /dev/null
+++ b/test/SemaTemplate/ms-class-specialization-class-scope.cpp
@@ -0,0 +1,49 @@
+// RUN: %clang_cc1 -fms-extensions -fsyntax-only -verify %s -Wno-microsoft
+// RUN: %clang_cc1 -fms-extensions -fdelayed-template-parsing -fsyntax-only -verify %s -Wno-microsoft
+
+class A {
+public:
+ template<typename T> struct X { typedef int x; };
+
+ X<int>::x a; // expected-note {{implicit instantiation first required here}}
+
+ template<> struct X<int>; // expected-error {{explicit specialization of 'A::X<int>' after instantiation}}
+ template<> struct X<char>; // expected-note {{forward declaration}}
+
+ X<char>::x b; // expected-error {{incomplete type 'A::X<char>' named in nested name specifier}}
+
+ template<> struct X<double> {
+ typedef int y;
+ };
+
+ X<double>::y c;
+
+ template<> struct X<float> {}; // expected-note {{previous definition is here}}
+ template<> struct X<float> {}; // expected-error {{redefinition of 'A::X<float>'}}
+};
+
+A::X<void>::x axv;
+A::X<float>::x axf; // expected-error {{no type named 'x'}}
+
+template<class T> class B {
+public:
+ template<typename U> struct X { typedef int x; };
+
+ typename X<int>::x a; // expected-note {{implicit instantiation first required here}}
+
+ template<> struct X<int>; // expected-error {{explicit specialization of 'X<int>' after instantiation}}
+ template<> struct X<char>; // expected-note {{forward declaration}}
+
+ typename X<char>::x b; // expected-error {{incomplete type 'B<float>::X<char>' named in nested name specifier}}
+
+ template<> struct X<double> {
+ typedef int y;
+ };
+
+ typename X<double>::y c;
+
+ template<> struct X<float> {}; // expected-note {{previous definition is here}}
+ template<> struct X<T> {}; // expected-error {{redefinition of 'X<float>'}}
+};
+
+B<float> b; // expected-note {{in instantiation of}}
OpenPOWER on IntegriCloud