]> granicus.if.org Git - clang/commitdiff
Test explicit specializations of static data members that are declarations, not defin...
authorDouglas Gregor <dgregor@apple.com>
Mon, 12 Oct 2009 21:37:59 +0000 (21:37 +0000)
committerDouglas Gregor <dgregor@apple.com>
Mon, 12 Oct 2009 21:37:59 +0000 (21:37 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83904 91177308-0d34-0410-b5e6-96231b3b80d8

test/CXX/temp/temp.spec/temp.expl.spec/p15.cpp [new file with mode: 0644]

diff --git a/test/CXX/temp/temp.spec/temp.expl.spec/p15.cpp b/test/CXX/temp/temp.spec/temp.expl.spec/p15.cpp
new file mode 100644 (file)
index 0000000..840f566
--- /dev/null
@@ -0,0 +1,22 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+
+struct NonDefaultConstructible {
+  NonDefaultConstructible(const NonDefaultConstructible&);
+};
+
+template<typename T, typename U>
+struct X {
+  static T member;
+};
+
+template<typename T, typename U>
+T X<T, U>::member; // expected-error{{no matching constructor}}
+
+// Okay; this is a declaration, not a definition.
+template<>
+NonDefaultConstructible X<NonDefaultConstructible, long>::member;
+
+NonDefaultConstructible &test(bool b) {
+  return b? X<NonDefaultConstructible, int>::member // expected-note{{instantiation}}
+          : X<NonDefaultConstructible, long>::member;
+}