From: Douglas Gregor Date: Mon, 12 Oct 2009 21:37:59 +0000 (+0000) Subject: Test explicit specializations of static data members that are declarations, not defin... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=65f6642e88ac39f2c1129f9b92b3fafd55dc32df;p=clang Test explicit specializations of static data members that are declarations, not definitions git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83904 91177308-0d34-0410-b5e6-96231b3b80d8 --- 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 index 0000000000..840f566362 --- /dev/null +++ b/test/CXX/temp/temp.spec/temp.expl.spec/p15.cpp @@ -0,0 +1,22 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +struct NonDefaultConstructible { + NonDefaultConstructible(const NonDefaultConstructible&); +}; + +template +struct X { + static T member; +}; + +template +T X::member; // expected-error{{no matching constructor}} + +// Okay; this is a declaration, not a definition. +template<> +NonDefaultConstructible X::member; + +NonDefaultConstructible &test(bool b) { + return b? X::member // expected-note{{instantiation}} + : X::member; +}