summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/AST/ExprConstant.cpp2
-rw-r--r--clang/test/SemaCXX/constant-expression-cxx2a.cpp9
2 files changed, 10 insertions, 1 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index cf28ecbe5ff..92ea1c93000 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -3997,7 +3997,7 @@ static bool handleIncDec(EvalInfo &Info, const Expr *E, const LValue &LVal,
/// Build an lvalue for the object argument of a member function call.
static bool EvaluateObjectArgument(EvalInfo &Info, const Expr *Object,
LValue &This) {
- if (Object->getType()->isPointerType())
+ if (Object->getType()->isPointerType() && Object->isRValue())
return EvaluatePointer(Object, This, Info);
if (Object->isGLValue())
diff --git a/clang/test/SemaCXX/constant-expression-cxx2a.cpp b/clang/test/SemaCXX/constant-expression-cxx2a.cpp
index ef3ce5c0ccb..cb8f16a8b0f 100644
--- a/clang/test/SemaCXX/constant-expression-cxx2a.cpp
+++ b/clang/test/SemaCXX/constant-expression-cxx2a.cpp
@@ -1283,6 +1283,15 @@ namespace dtor_call {
// FIXME: This diagnostic is wrong; the union has no active member now.
as.b.~A(); // expected-note {{destruction of member 'b' of union with active member 'a'}}
}
+
+ constexpr void destroy_pointer() {
+ using T = int*;
+ T p;
+ // We used to think this was an -> member access because its left-hand side
+ // is a pointer. Ensure we don't crash.
+ p.~T();
+ }
+ static_assert((destroy_pointer(), true));
}
namespace temp_dtor {
OpenPOWER on IntegriCloud