From 8d0d49f8b457d47539898886e3f94aaee9c572d6 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 3 Apr 2018 15:13:42 -0400 Subject: [PATCH] PR c++/85092 - C++17 ICE with unused list constructor. * call.c (conv_binds_ref_to_prvalue): Also count ck_identity from a TARGET_EXPR. From-SVN: r259052 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/call.c | 3 +++ gcc/testsuite/g++.dg/cpp0x/initlist99.C | 13 +++++++++++++ 3 files changed, 20 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist99.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 648a71d4897..4a9f9995d24 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2018-04-03 Jason Merrill + PR c++/85092 - C++17 ICE with unused list constructor. + * call.c (conv_binds_ref_to_prvalue): Also count ck_identity + from a TARGET_EXPR. + PR c++/85113 - ICE with constexpr and __builtin_constant_p. * constexpr.c (cxx_eval_builtin_function_call): Only defer __builtin_constant_p if ctx->quiet. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 9351918b23a..901f18c43e6 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -7611,6 +7611,9 @@ conv_binds_ref_to_prvalue (conversion *c) return true; if (c->kind == ck_user && TREE_CODE (c->type) != REFERENCE_TYPE) return true; + if (c->kind == ck_identity && c->u.expr + && TREE_CODE (c->u.expr) == TARGET_EXPR) + return true; return false; } diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist99.C b/gcc/testsuite/g++.dg/cpp0x/initlist99.C new file mode 100644 index 00000000000..d96f793d398 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist99.C @@ -0,0 +1,13 @@ +// PR c++/85092 +// { dg-do compile { target c++11 } } + +#include + +struct A +{ + A (std::initializer_list); +}; + +A f (); + +A a { f () }; -- 2.30.2