From 222e2a7620e6520ffaf4fc4e69d79c18da31542e Mon Sep 17 00:00:00 2001 From: "Zancanaro; Carlo" Date: Mon, 24 Sep 2012 09:58:17 +1000 Subject: Add the clang library to the repo (with some of my changes, too). --- clang/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p1.cpp | 32 ++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 clang/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p1.cpp (limited to 'clang/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p1.cpp') diff --git a/clang/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p1.cpp b/clang/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p1.cpp new file mode 100644 index 0000000..cbb439e --- /dev/null +++ b/clang/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p1.cpp @@ -0,0 +1,32 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +// A storage-class-specifier shall not be specified in an explicit +// specialization (14.7.3) or an explicit instantiation (14.7.2) +// directive. +template void f(T) {} +template static void g(T) {} + + +template<> static void f(int); // expected-error{{explicit specialization has extraneous, inconsistent storage class 'static'}} +template static void f(float); // expected-error{{explicit instantiation cannot have a storage class}} + +template<> void f(double); +template void f(long); + +template<> static void g(int); // expected-warning{{explicit specialization cannot have a storage class}} +template static void g(float); // expected-error{{explicit instantiation cannot have a storage class}} + +template<> void g(double); +template void g(long); + +template +struct X { + static int value; +}; + +template +int X::value = 17; + +template static int X::value; // expected-error{{explicit instantiation cannot have a storage class}} + +template<> static int X::value; // expected-error{{'static' can only be specified inside the class definition}} -- cgit v1.2.3