re PR c++/78488 (P0136R1 ICE when building call to inherited default constructor.)
authorNathan Sidwell <nathan@acm.org>
Wed, 18 Jan 2017 19:27:52 +0000 (19:27 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Wed, 18 Jan 2017 19:27:52 +0000 (19:27 +0000)
PR c++/78488
* call.c (build_over_call): When checking ellipsis conversions for
an inherited ctor, make sure there is at least one conversion.

* g++.dg/cpp1z/inh-ctor37.C: New.

From-SVN: r244592

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp1z/inh-ctor37.C [new file with mode: 0644]

index 868475521d5768aa947b9cb12f93ed73a74344a3..11dfbad243038c5ab6b19f2350a98ea1addb4466 100644 (file)
@@ -1,3 +1,9 @@
+2017-01-18  Nathan Sidwell  <nathan@acm.org>
+
+       PR c++/78488
+       * call.c (build_over_call): When checking ellipsis conversions for
+       an inherited ctor, make sure there is at least one conversion.
+
 2017-01-18  Jason Merrill  <jason@redhat.com>
 
        PR c++/78894 - ICE with class deduction and default arg
index e431221c1594c979ff0d8c5c6b78a5951905b0c7..88d83dd8a5d056c61cdfd81f65f08be9203dffa3 100644 (file)
@@ -7899,6 +7899,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
         could handle this by open-coding the inherited constructor rather than
         defining it, but let's not bother now.  */
       if (!cp_unevaluated_operand
+         && cand->num_convs
          && cand->convs[cand->num_convs-1]->ellipsis_p)
        {
          if (complain & tf_error)
index 538e08effe20a594c292c03b581de0d861923932..e142e3eb55788c6702a5d0043a005765d7139d1f 100644 (file)
@@ -1,3 +1,8 @@
+2017-01-18  Nathan Sidwell  <nathan@acm.org>
+
+       PR c++/78488
+       * g++.dg/cpp1z/inh-ctor37.C: New.
+
 2017-01-18  Uros Bizjak  <ubizjak@gmail.com>
 
        PR rtl-optimization/78952
diff --git a/gcc/testsuite/g++.dg/cpp1z/inh-ctor37.C b/gcc/testsuite/g++.dg/cpp1z/inh-ctor37.C
new file mode 100644 (file)
index 0000000..d501c5b
--- /dev/null
@@ -0,0 +1,13 @@
+// { dg-do compile { target c++11 } }
+// PR 78488, seg fault with inherited ctor
+
+struct Foo { Foo() {} };
+
+struct Bar : Foo {
+  using Foo::Foo;
+  Bar(void*);
+};
+
+int main() {
+ Bar f;
+}