diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-01-12 06:08:57 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-01-12 06:08:57 +0000 |
commit | 61e616206413d1779c7545c7a8ad1ce1129ad9c1 (patch) | |
tree | 864235e3a0798289f3c267470fde05b3c0f171a0 /test/CXX/expr/expr.const | |
parent | 746f5bcbfde5b25269169c63c66492311673b67d (diff) |
Allow constant-folding of references which were formed in a manner not permitted
in a constant expression, for compatibility with g++.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148020 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CXX/expr/expr.const')
-rw-r--r-- | test/CXX/expr/expr.const/p2-0x.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/test/CXX/expr/expr.const/p2-0x.cpp b/test/CXX/expr/expr.const/p2-0x.cpp index 78d78b64c7..cece22d9b2 100644 --- a/test/CXX/expr/expr.const/p2-0x.cpp +++ b/test/CXX/expr/expr.const/p2-0x.cpp @@ -134,8 +134,9 @@ namespace UndefinedBehavior { constexpr const int &f(const int *q) { return q[0]; // expected-note {{dereferenced pointer past the end of subobject of 's' is not a constant expression}} } + constexpr int n = (f(p), 0); // expected-error {{constant expression}} expected-note {{in call to 'f(&s.m + 1)'}} struct T { - int n : f(p); // expected-error {{not an integer constant expression}} expected-note {{in call to 'f(&s.m + 1)'}} + int n : f(p); // expected-error {{not an integer constant expression}} expected-note {{read of dereferenced one-past-the-end pointer}} }; namespace Ptr { |