diff options
author | Larisse Voufo <lvoufo@google.com> | 2013-08-22 00:59:14 +0000 |
---|---|---|
committer | Larisse Voufo <lvoufo@google.com> | 2013-08-22 00:59:14 +0000 |
commit | 72caf2bb6bae001319d1b0d924821442d13bf541 (patch) | |
tree | df17618b6cb9891264c691f27e5467d281172479 /clang/test/SemaCXX/cxx1y-variable-templates_top_level.cpp | |
parent | 6c46216daff59623f20a2a389ebd1eea39cdf376 (diff) | |
download | bcm5719-llvm-72caf2bb6bae001319d1b0d924821442d13bf541.tar.gz bcm5719-llvm-72caf2bb6bae001319d1b0d924821442d13bf541.zip |
Refactor for clarity and simplicity.
llvm-svn: 188974
Diffstat (limited to 'clang/test/SemaCXX/cxx1y-variable-templates_top_level.cpp')
-rw-r--r-- | clang/test/SemaCXX/cxx1y-variable-templates_top_level.cpp | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/clang/test/SemaCXX/cxx1y-variable-templates_top_level.cpp b/clang/test/SemaCXX/cxx1y-variable-templates_top_level.cpp index 61fccac038b..49be0bdcbe2 100644 --- a/clang/test/SemaCXX/cxx1y-variable-templates_top_level.cpp +++ b/clang/test/SemaCXX/cxx1y-variable-templates_top_level.cpp @@ -1,11 +1,11 @@ -// RUN: %clang_cc1 -verify -fsyntax-only -Wno-c++11-extensions -Wno-c++1y-extensions %s -// RUN: %clang_cc1 -std=c++11 -verify -fsyntax-only -Wno-c++1y-extensions %s -DCXX11 -// RUN: %clang_cc1 -std=c++1y -verify -fsyntax-only %s -DCXX11 +// RUN: %clang_cc1 -verify -fsyntax-only -Wno-c++11-extensions -Wno-c++1y-extensions %s -DPRECXX11 +// RUN: %clang_cc1 -std=c++11 -verify -fsyntax-only -Wno-c++1y-extensions %s +// RUN: %clang_cc1 -std=c++1y -verify -fsyntax-only %s -#ifdef CXX11 - #define CONST constexpr -#else +#ifdef PRECXX11 #define CONST const +#else + #define CONST constexpr #endif template<typename T> @@ -15,7 +15,7 @@ template<typename T> CONST T cpi = T(3.1415926535897932385); // expected-note {{template is declared here}} template<typename T> extern CONST T vc; -#ifdef CXX11 +#ifndef PRECXX11 // expected-error@-2 {{constexpr variable declaration must be a definition}} #endif @@ -46,7 +46,7 @@ namespace use_in_top_level_funcs { double use_circular_area(double r) { CONST float t = const_circular_area(2.0) - 12; -#ifdef CXX11 +#ifndef PRECXX11 static_assert(const_circular_area(2) == 12, ""); CONST int test = (t > 0) && (t < 1); static_assert(test, ""); @@ -104,7 +104,7 @@ namespace odr_tmpl { // expected-note {{previous definition is here}} template<typename T> extern int v; // expected-error {{redefinition of 'v' with a different type: 'int' vs 'T'}} -#ifdef CXX11 +#ifndef PRECXX11 template<typename T> extern auto v; // expected-error {{declaration of variable 'v' with type 'auto' requires an initializer}} #endif @@ -112,7 +112,7 @@ namespace odr_tmpl { extern int var; // expected-error {{redefinition of 'var' as different kind of symbol}} } -#ifdef CXX11 +#ifndef PRECXX11 namespace pvt_auto { template<typename T> auto v0; // expected-error {{declaration of variable 'v0' with type 'auto' requires an initializer}} template<typename T> auto v1 = T(); // expected-note {{previous definition is here}} @@ -159,7 +159,7 @@ namespace explicit_instantiation { template CONST int pi1<int>; // expected-note {{previous explicit instantiation is here}} template CONST int pi1<int>; // expected-error {{duplicate explicit instantiation of 'pi1<int>'}} -#ifdef CXX11 +#ifndef PRECXX11 namespace auto_var { template<typename T> auto var0 = T(); template auto var0<int>; // expected-error {{'auto' variable template instantiation is not allowed}} @@ -188,7 +188,7 @@ namespace explicit_specialization { template<> CONST int pi2<int,int> = 4; -#ifdef CXX11 +#ifndef PRECXX11 void foo() { static_assert(pi2<int,int> == 4, ""); static_assert(pi2<float,int> == 2, ""); @@ -242,13 +242,13 @@ namespace explicit_specialization { T pi0 = T(3.1415926535897932385); template<> int pi0<int> = 10; // expected-note 3{{previous definition is here}} -#ifdef CXX11 +#ifndef PRECXX11 // expected-note@-2 {{previous definition is here}} #endif template<> int pi0<int> = 10; // expected-error {{redefinition of 'pi0<int>'}} template<> CONST int pi0<int> = 10; // expected-error {{redefinition of 'pi0' with a different type: 'const int' vs 'int'}} template<> float pi0<int> = 10; // expected-error {{redefinition of 'pi0' with a different type: 'float' vs 'int'}} -#ifdef CXX11 +#ifndef PRECXX11 template<> auto pi0<int> = 10; // expected-error {{redefinition of 'pi0<int>'}} #endif @@ -289,7 +289,7 @@ namespace explicit_specialization { template<typename T> CONST int pi2<T,int> = 2; } -#ifdef CXX11 +#ifndef PRECXX11 namespace auto_var { template<typename T, typename> auto var0 = T(); template<typename T> auto var0<T,int> = T(); @@ -314,7 +314,7 @@ namespace explicit_specialization { // TODO: template<typename T> T var = T(); template<typename T> T* var<T> = new T(); -#ifdef CXX11 +#ifndef PRECXX11 template<typename T> auto var<T*> = T(); // expected-note {{previous definition is here}} template<typename T> T var<T*> = T(); // expected-error {{redefinition of 'var' with a different type: 'T' vs 'auto'}} #endif @@ -323,7 +323,7 @@ namespace explicit_specialization { namespace narrowing { template<typename T> T v = {1234}; // expected-warning {{implicit conversion from 'int' to 'char' changes value from 1234 to}} -#ifdef CXX11 +#ifndef PRECXX11 // expected-error@-2 {{constant expression evaluates to 1234 which cannot be narrowed to type 'char'}}\ // expected-note@-2 {{override this message by inserting an explicit cast}} #endif @@ -338,7 +338,7 @@ namespace attributes { // TODO: } -#ifdef CXX11 +#ifndef PRECXX11 namespace arrays { template<typename T> T* arr = new T[10]{T(10), T(23)}; @@ -390,13 +390,13 @@ namespace nested { namespace n1 { template<typename T> T pi1a = T(3.1415926535897932385); -#ifdef CXX11 +#ifndef PRECXX11 // expected-note@-2 {{explicit instantiation refers here}} #endif template<typename T> T pi1b = T(3.1415926535897932385); // expected-note {{explicitly specialized declaration is here}} -#ifdef CXX11 +#ifndef PRECXX11 // expected-note@-2 {{explicit instantiation refers here}} #endif } @@ -406,7 +406,7 @@ namespace nested { int i1 = pi1a<int>; template float pi1a<float>; -#ifdef CXX11 +#ifndef PRECXX11 // expected-error@-2 {{explicit instantiation of 'pi1a<float>' not in a namespace enclosing 'n1'}} #endif float f1 = pi1a<float>; @@ -419,7 +419,7 @@ namespace nested { int i1 = n1::pi1b<int>; template float n1::pi1b<float>; -#ifdef CXX11 +#ifndef PRECXX11 // expected-error@-2 {{explicit instantiation of 'pi1b<float>' not in a namespace enclosing 'n1'}} #endif float f1 = n1::pi1b<float>; |