PR c++/85092 - C++17 ICE with unused list constructor.
authorJason Merrill <jason@redhat.com>
Tue, 3 Apr 2018 19:13:42 +0000 (15:13 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 3 Apr 2018 19:13:42 +0000 (15:13 -0400)
* call.c (conv_binds_ref_to_prvalue): Also count ck_identity
from a TARGET_EXPR.

From-SVN: r259052

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/testsuite/g++.dg/cpp0x/initlist99.C [new file with mode: 0644]

index 648a71d4897f142553c6fe64a3eda28a6103fb72..4a9f9995d2438972588f76c458e7a5e4dd829f25 100644 (file)
@@ -1,5 +1,9 @@
 2018-04-03  Jason Merrill  <jason@redhat.com>
 
+       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.
index 9351918b23af81b10bd1aa0e03b7f57b38e56552..901f18c43e6717483e4b65b71d038de607bbcbaa 100644 (file)
@@ -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 (file)
index 0000000..d96f793
--- /dev/null
@@ -0,0 +1,13 @@
+// PR c++/85092
+// { dg-do compile { target c++11 } }
+
+#include <initializer_list>
+
+struct A
+{
+  A (std::initializer_list<char>);
+};
+
+A f ();
+
+A a { f () };