Allow constant-folding of references which were formed in a manner not permitted
in a constant expression, for compatibility with g++.
llvm-svn: 148020
diff --git a/clang/test/CXX/expr/expr.const/p2-0x.cpp b/clang/test/CXX/expr/expr.const/p2-0x.cpp
index 78d78b6..cece22d 100644
--- a/clang/test/CXX/expr/expr.const/p2-0x.cpp
+++ b/clang/test/CXX/expr/expr.const/p2-0x.cpp
@@ -134,8 +134,9 @@
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 {