diff options
author | dim <dim@FreeBSD.org> | 2013-12-22 00:07:40 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2013-12-22 00:07:40 +0000 |
commit | 952eddef9aff85b1e92626e89baaf7a360e2ac85 (patch) | |
tree | df8df0b0067b381eab470a3b8f28d14a552a6340 /test/CXX/expr/expr.const | |
parent | ea266cad53e3d49771fa38103913d3ec7a166694 (diff) | |
download | FreeBSD-src-952eddef9aff85b1e92626e89baaf7a360e2ac85.zip FreeBSD-src-952eddef9aff85b1e92626e89baaf7a360e2ac85.tar.gz |
Vendor import of clang release_34 branch r197841 (effectively, 3.4 RC3):
https://llvm.org/svn/llvm-project/cfe/branches/release_34@197841
Diffstat (limited to 'test/CXX/expr/expr.const')
-rw-r--r-- | test/CXX/expr/expr.const/p2-0x.cpp | 12 | ||||
-rw-r--r-- | test/CXX/expr/expr.const/p3-0x.cpp | 2 |
2 files changed, 7 insertions, 7 deletions
diff --git a/test/CXX/expr/expr.const/p2-0x.cpp b/test/CXX/expr/expr.const/p2-0x.cpp index 634dee3..f0b53c7 100644 --- a/test/CXX/expr/expr.const/p2-0x.cpp +++ b/test/CXX/expr/expr.const/p2-0x.cpp @@ -275,9 +275,7 @@ namespace UndefinedBehavior { // - a lambda-expression (5.1.2); struct Lambda { - // FIXME: clang crashes when trying to parse this! Revisit this check once - // lambdas are fully implemented. - //int n : []{ return 1; }(); + int n : []{ return 1; }(); // expected-error {{constant expression}} expected-error {{integral constant expression}} }; // - an lvalue-to-rvalue conversion (4.1) unless it is applied to @@ -322,7 +320,7 @@ namespace LValueToRValue { // constant expression; constexpr volatile S f() { return S(); } static_assert(f().i, ""); // ok! there's no lvalue-to-rvalue conversion here! - static_assert(((volatile const S&&)(S)0).i, ""); // expected-error {{constant expression}} + static_assert(((volatile const S&&)(S)0).i, ""); // expected-error {{constant expression}} expected-note {{read of volatile-qualified type}} } // DR1312: The proposed wording for this defect has issues, so we ignore this @@ -481,17 +479,19 @@ namespace UnspecifiedRelations { public: constexpr A() : a(0), b(0) {} int a; - constexpr bool cmp() const { return &a < &b; } // expected-error {{constexpr function never produces a constant expression}} expected-note {{comparison of address of fields 'a' and 'b' of 'A' with differing access specifiers (public vs private) has unspecified value}} + constexpr bool cmp() const { return &a < &b; } // expected-note {{comparison of address of fields 'a' and 'b' of 'A' with differing access specifiers (public vs private) has unspecified value}} private: int b; }; + static_assert(A().cmp(), ""); // expected-error {{constant expression}} expected-note {{in call}} class B { public: A a; - constexpr bool cmp() const { return &a.a < &b.a; } // expected-error {{constexpr function never produces a constant expression}} expected-note {{comparison of address of fields 'a' and 'b' of 'B' with differing access specifiers (public vs protected) has unspecified value}} + constexpr bool cmp() const { return &a.a < &b.a; } // expected-note {{comparison of address of fields 'a' and 'b' of 'B' with differing access specifiers (public vs protected) has unspecified value}} protected: A b; }; + static_assert(B().cmp(), ""); // expected-error {{constant expression}} expected-note {{in call}} // If two pointers point to different base sub-objects of the same object, or // one points to a base subobject and the other points to a member, the result diff --git a/test/CXX/expr/expr.const/p3-0x.cpp b/test/CXX/expr/expr.const/p3-0x.cpp index 047e238..e3e32df 100644 --- a/test/CXX/expr/expr.const/p3-0x.cpp +++ b/test/CXX/expr/expr.const/p3-0x.cpp @@ -93,7 +93,7 @@ void c() { break; } } -template<bool B> int f() { return B; } +template <bool B> int f() { return B; } // expected-note {{candidate template ignored: invalid explicitly-specified argument for template parameter 'B'}} template int f<&S::operator int>(); // expected-error {{does not refer to a function template}} template int f<(bool)&S::operator int>(); |