diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2011-12-30 03:11:50 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2011-12-30 03:11:50 +0000 |
commit | f8c2a33b6e47c494b83e68f02f4ee67ca8fd8e3b (patch) | |
tree | 6194f3b0d54211c78b495dd8d14e1d69a3041679 /test | |
parent | d7c56e1114bfe7d461786903bb720d2c6efc05a1 (diff) |
Revert r147271. This fixes PR11676.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147362 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/CXX/expr/expr.const/p2-0x.cpp | 4 | ||||
-rw-r--r-- | test/CXX/special/class.ctor/p6-0x.cpp | 12 | ||||
-rw-r--r-- | test/CodeGenCXX/value-init.cpp | 3 | ||||
-rw-r--r-- | test/SemaCXX/constexpr-printing.cpp | 7 | ||||
-rw-r--r-- | test/SemaCXX/constexpr-value-init.cpp | 31 | ||||
-rw-r--r-- | test/SemaObjCXX/arc-type-traits.mm | 16 |
6 files changed, 16 insertions, 57 deletions
diff --git a/test/CXX/expr/expr.const/p2-0x.cpp b/test/CXX/expr/expr.const/p2-0x.cpp index f0581fcc09..d95af8a95f 100644 --- a/test/CXX/expr/expr.const/p2-0x.cpp +++ b/test/CXX/expr/expr.const/p2-0x.cpp @@ -33,11 +33,11 @@ struct NonConstexpr3 { int m : NonConstexpr2().n; // expected-error {{constant expression}} expected-note {{undefined constructor 'NonConstexpr2'}} }; struct NonConstexpr4 { - NonConstexpr4(); // expected-note {{declared here}} + NonConstexpr4(); int n; }; struct NonConstexpr5 { - int n : NonConstexpr4().n; // expected-error {{constant expression}} expected-note {{non-constexpr constructor 'NonConstexpr4' cannot be used in a constant expression}} + int n : NonConstexpr4().n; // expected-error {{constant expression}} expected-note {{non-literal type 'NonConstexpr4' cannot be used in a constant expression}} }; // - an invocation of an undefined constexpr function or an undefined diff --git a/test/CXX/special/class.ctor/p6-0x.cpp b/test/CXX/special/class.ctor/p6-0x.cpp index 71afd244bd..19e324d8df 100644 --- a/test/CXX/special/class.ctor/p6-0x.cpp +++ b/test/CXX/special/class.ctor/p6-0x.cpp @@ -8,16 +8,8 @@ struct NonConstexpr1 { // expected-note {{here}} struct NonConstexpr2 { // expected-note {{here}} NonConstexpr1 nl; }; -struct NonConstexpr2a : NonConstexpr1 { }; -constexpr NonConstexpr1 nc1 = NonConstexpr1(); // ok, does not call constructor -constexpr NonConstexpr2 nc2 = NonConstexpr2(); // ok, does not call constructor -constexpr NonConstexpr2a nc2a = NonConstexpr2a(); // expected-error {{constant expression}} expected-note {{non-literal type 'const NonConstexpr2a'}} -constexpr int nc2_a = NonConstexpr2().nl.a; // ok -constexpr int nc2a_a = NonConstexpr2a().a; // ok -struct Helper { - friend constexpr NonConstexpr1::NonConstexpr1(); // expected-error {{follows non-constexpr declaration}} - friend constexpr NonConstexpr2::NonConstexpr2(); // expected-error {{follows non-constexpr declaration}} -}; +constexpr NonConstexpr1 nc1 = NonConstexpr1(); // expected-error {{constant expression}} expected-note {{non-constexpr constructor 'NonConstexpr1'}} +constexpr NonConstexpr2 nc2 = NonConstexpr2(); // expected-error {{constant expression}} expected-note {{non-constexpr constructor 'NonConstexpr2'}} struct Constexpr1 {}; constexpr Constexpr1 c1 = Constexpr1(); // ok diff --git a/test/CodeGenCXX/value-init.cpp b/test/CodeGenCXX/value-init.cpp index 6e60f80110..fb981d1ff7 100644 --- a/test/CodeGenCXX/value-init.cpp +++ b/test/CodeGenCXX/value-init.cpp @@ -134,7 +134,8 @@ namespace zeroinit { // CHECK: define i32 @_ZN8zeroinit4testEv() int test() { // CHECK: call void @llvm.memset.p0i8.i64 - // CHECK: ret i32 0 + // CHECK: getelementptr + // CHECK: ret i32 return S().i; } diff --git a/test/SemaCXX/constexpr-printing.cpp b/test/SemaCXX/constexpr-printing.cpp index cccefca9fa..e6cf209819 100644 --- a/test/SemaCXX/constexpr-printing.cpp +++ b/test/SemaCXX/constexpr-printing.cpp @@ -11,11 +11,8 @@ struct S { constexpr int extract(const S &s) { return s.n; } // expected-note {{read of uninitialized object is not allowed in a constant expression}} -constexpr S s1; // ok -void f() { - constexpr S s1; // expected-error {{constant expression}} expected-note {{in call to 'S()'}} - constexpr S s2(10); -} +constexpr S s1; // expected-error {{constant expression}} expected-note {{in call to 'S()'}} +constexpr S s2(10); typedef __attribute__((vector_size(16))) int vector_int; diff --git a/test/SemaCXX/constexpr-value-init.cpp b/test/SemaCXX/constexpr-value-init.cpp deleted file mode 100644 index efa9e94da1..0000000000 --- a/test/SemaCXX/constexpr-value-init.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// RUN: %clang_cc1 %s -std=c++11 -fsyntax-only -verify - -struct A { - constexpr A() : a(b + 1), b(a + 1) {} // expected-note {{uninitialized}} - int a; - int b; -}; -struct B { - A a; -}; - -constexpr A a; // ok, zero initialization preceeds static initialization -void f() { - constexpr A a; // expected-error {{constant expression}} expected-note {{in call to 'A()'}} -} - -constexpr B b1; // expected-error {{requires a user-provided default constructor}} -constexpr B b2 = B(); // ok -static_assert(b2.a.a == 1, ""); -static_assert(b2.a.b == 2, ""); - -struct C { - int c; -}; -struct D : C { int d; }; -constexpr C c1; // expected-error {{requires a user-provided default constructor}} -constexpr C c2 = C(); // ok -constexpr D d1; // expected-error {{requires a user-provided default constructor}} -constexpr D d2 = D(); // expected-error {{constant expression}} expected-note {{non-literal type 'const D'}} -static_assert(D().c == 0, ""); -static_assert(D().d == 0, ""); diff --git a/test/SemaObjCXX/arc-type-traits.mm b/test/SemaObjCXX/arc-type-traits.mm index 9877870f94..b876018e25 100644 --- a/test/SemaObjCXX/arc-type-traits.mm +++ b/test/SemaObjCXX/arc-type-traits.mm @@ -53,16 +53,16 @@ TRAIT_IS_TRUE(__has_trivial_destructor, __autoreleasing id); TRAIT_IS_TRUE(__has_trivial_destructor, __unsafe_unretained id); // __is_literal -TRAIT_IS_TRUE(__is_literal, __strong id); -TRAIT_IS_TRUE(__is_literal, __weak id); -TRAIT_IS_TRUE(__is_literal, __autoreleasing id); -TRAIT_IS_TRUE(__is_literal, __unsafe_unretained id); +TRAIT_IS_FALSE(__is_literal, __strong id); +TRAIT_IS_FALSE(__is_literal, __weak id); +TRAIT_IS_FALSE(__is_literal, __autoreleasing id); +TRAIT_IS_FALSE(__is_literal, __unsafe_unretained id); // __is_literal_type -TRAIT_IS_TRUE(__is_literal_type, __strong id); -TRAIT_IS_TRUE(__is_literal_type, __weak id); -TRAIT_IS_TRUE(__is_literal_type, __autoreleasing id); -TRAIT_IS_TRUE(__is_literal_type, __unsafe_unretained id); +TRAIT_IS_FALSE(__is_literal_type, __strong id); +TRAIT_IS_FALSE(__is_literal_type, __weak id); +TRAIT_IS_FALSE(__is_literal_type, __autoreleasing id); +TRAIT_IS_FALSE(__is_literal_type, __unsafe_unretained id); // __is_pod TRAIT_IS_FALSE(__is_pod, __strong id); |