aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2017-03-16 21:16:33 +0000
committerJason Merrill <jason@redhat.com>2017-03-16 21:16:33 +0000
commit4c5193c673d78953dbce47d4521df6cccca5ac9b (patch)
treeed1b3919e2bdb89acc5d15fb8dcd211c60dd70e2
parenta9d9d889c324a16cfcbcda3b75eb984d12b34496 (diff)
PR c++/79797
* constexpr.c (lookup_placeholder): Tweak. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@246210 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/constexpr.c7
2 files changed, 10 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index e5fa93aefb3..99836fbaeea 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2017-03-16 Jason Merrill <jason@redhat.com>
+
+ PR c++/79797
+ * constexpr.c (lookup_placeholder): Tweak.
+
2017-03-15 Jason Merrill <jason@redhat.com>
PR c++/80043 - ICE with -fpermissive
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index 2510e23e61b..4136b349282 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -3832,14 +3832,17 @@ cxx_eval_switch_expr (const constexpr_ctx *ctx, tree t,
static tree
lookup_placeholder (const constexpr_ctx *ctx, bool lval, tree type)
{
- if (!ctx || !ctx->ctor || (lval && !ctx->object))
+ if (!ctx)
return NULL_TREE;
/* We could use ctx->object unconditionally, but using ctx->ctor when we
can is a minor optimization. */
- if (!lval && same_type_p (TREE_TYPE (ctx->ctor), type))
+ if (!lval && ctx->ctor && same_type_p (TREE_TYPE (ctx->ctor), type))
return ctx->ctor;
+ if (!ctx->object)
+ return NULL_TREE;
+
/* Since an object cannot have a field of its own type, we can search outward
from ctx->object to find the unique containing object of TYPE. */
tree ob = ctx->object;