aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2018-04-05 12:42:09 -0400
committerJason Merrill <jason@gcc.gnu.org>2018-04-05 12:42:09 -0400
commitbe9d76c5bf7e256dbacd34d166079b75103882ba (patch)
tree7d4e453e2022d0d1cd0d277b7817502c75306660
parent68218b64edccb3286d57217f7bd85264340e5a9f (diff)
downloadgcc-be9d76c5bf7e256dbacd34d166079b75103882ba.zip
gcc-be9d76c5bf7e256dbacd34d166079b75103882ba.tar.gz
gcc-be9d76c5bf7e256dbacd34d166079b75103882ba.tar.bz2
PR c++/82152 - ICE with class deduction and inherited ctor.
* pt.c (do_class_deduction): Ignore inherited ctors. From-SVN: r259133
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/pt.c4
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/class-deduction54.C15
3 files changed, 22 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index b453577..a876dc9 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,8 @@
2018-04-05 Jason Merrill <jason@redhat.com>
+ PR c++/82152 - ICE with class deduction and inherited ctor.
+ * pt.c (do_class_deduction): Ignore inherited ctors.
+
PR c++/84665 - ICE with array of empty class.
* decl2.c (cp_check_const_attributes): Use fold_non_dependent_expr.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index dc74635..dc2310a 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -26217,6 +26217,10 @@ do_class_deduction (tree ptype, tree tmpl, tree init, int flags,
// FIXME cache artificial deduction guides
for (ovl_iterator iter (CLASSTYPE_CONSTRUCTORS (type)); iter; ++iter)
{
+ /* Skip inherited constructors. */
+ if (iter.using_p ())
+ continue;
+
tree guide = build_deduction_guide (*iter, outer_args, complain);
if (guide == error_mark_node)
return error_mark_node;
diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction54.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction54.C
new file mode 100644
index 0000000..e51398b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction54.C
@@ -0,0 +1,15 @@
+// PR c++/82152
+// { dg-additional-options -std=c++17 }
+
+struct Base {};
+
+template<typename T>
+struct Derived : public Base {
+ using Base::Base;
+};
+
+Derived() -> Derived< void >;
+
+int main() {
+ Derived x;
+}