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/SemaTemplate/temp_class_spec_neg.cpp | 45 +++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 clang/test/SemaTemplate/temp_class_spec_neg.cpp (limited to 'clang/test/SemaTemplate/temp_class_spec_neg.cpp') diff --git a/clang/test/SemaTemplate/temp_class_spec_neg.cpp b/clang/test/SemaTemplate/temp_class_spec_neg.cpp new file mode 100644 index 0000000..be5fbb1 --- /dev/null +++ b/clang/test/SemaTemplate/temp_class_spec_neg.cpp @@ -0,0 +1,45 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +template struct vector; + +// C++ [temp.class.spec]p6: +namespace N { + namespace M { + template struct A; // expected-note{{here}} + } +} + +template +struct N::M::A { }; // expected-warning{{C++11 extension}} + +// C++ [temp.class.spec]p9 +// bullet 1 +template struct A {}; +template struct A {}; // expected-error{{depends on}} +template struct B {}; +template struct B {}; //OK + +// bullet 2 +template struct C {}; // expected-note{{declared here}} +template struct C; // expected-error{{specializes}} +template struct C; // okay + +template< int X, int (*array_ptr)[X] > class A2 {}; // expected-note{{here}} +int array[5]; +template< int X > class A2 { }; // expected-error{{specializes}} + +template class TT> +struct Test0; + +// bullet 3 +template class TT> +struct Test0; // expected-error{{does not specialize}} + +// C++ [temp.class.spec]p10 +template class TT = ::vector> // expected-error{{default template argument}} + struct Test0 { }; + +template struct Test1; +template // expected-note{{non-deducible}} + struct Test1 { }; // expected-warning{{never be used}} -- cgit v1.2.3