aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/AST/ExprConstant.cpp4
-rw-r--r--test/Sema/const-eval.c2
-rw-r--r--test/SemaCXX/constant-expression-cxx11.cpp3
3 files changed, 4 insertions, 5 deletions
diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp
index 1c0d9eae69..6a292c3925 100644
--- a/lib/AST/ExprConstant.cpp
+++ b/lib/AST/ExprConstant.cpp
@@ -950,10 +950,6 @@ static bool EvalPointerValueAsBool(const CCValue &Value, bool &Result) {
return true;
}
- // Require the base expression to be a global l-value.
- // FIXME: C++11 requires such conversions. Remove this check.
- if (!IsGlobalLValue(Value.getLValueBase())) return false;
-
// We have a non-null base. These are generally known to be true, but if it's
// a weak declaration it can be null at runtime.
Result = true;
diff --git a/test/Sema/const-eval.c b/test/Sema/const-eval.c
index a40039bdc5..22ac67adad 100644
--- a/test/Sema/const-eval.c
+++ b/test/Sema/const-eval.c
@@ -24,7 +24,7 @@ EVAL_EXPR(14, (1 ^ l_19) && 1); // expected-error {{fields must have a constant
void f()
{
int a;
- EVAL_EXPR(15, (_Bool)&a); // expected-error {{fields must have a constant size}}
+ EVAL_EXPR(15, (_Bool)&a);
}
// FIXME: Turn into EVAL_EXPR test once we have more folding.
diff --git a/test/SemaCXX/constant-expression-cxx11.cpp b/test/SemaCXX/constant-expression-cxx11.cpp
index af66acda0a..3c85adcc18 100644
--- a/test/SemaCXX/constant-expression-cxx11.cpp
+++ b/test/SemaCXX/constant-expression-cxx11.cpp
@@ -737,6 +737,9 @@ constexpr int f(const S &s) {
constexpr int n = f(T(5));
static_assert(f(T(5)) == 5, "");
+constexpr bool b(int n) { return &n; }
+static_assert(b(0), "");
+
}
namespace Union {