From 17434237d3132a425c988dd8c0d1ac1a63ca34ae Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 9 Apr 2018 16:53:31 -0400 Subject: [PATCH] PR c++/85262 - ICE with redundant qualification on constructor. * call.c (build_new_method_call_1): Move make_args_non_dependent after A::A() handling. From-SVN: r259255 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/call.c | 17 +++++++++-------- gcc/testsuite/g++.dg/parse/ctor10.C | 14 ++++++++++++++ 3 files changed, 27 insertions(+), 8 deletions(-) create mode 100644 gcc/testsuite/g++.dg/parse/ctor10.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0017c34..37f446f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2018-04-09 Jason Merrill + PR c++/85262 - ICE with redundant qualification on constructor. + * call.c (build_new_method_call_1): Move make_args_non_dependent + after A::A() handling. + PR c++/85277 - ICE with invalid offsetof. * semantics.c (finish_offsetof): Avoid passing non-DECL to %qD. Adjust -Winvalid-offsetof diagnostic to say conditionally supported. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index b22a3cc..f978ea7 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -9104,14 +9104,6 @@ build_new_method_call_1 (tree instance, tree fns, vec **args, basetype = TYPE_MAIN_VARIANT (TREE_TYPE (instance)); gcc_assert (CLASS_TYPE_P (basetype)); - if (processing_template_decl) - { - orig_args = args == NULL ? NULL : make_tree_vector_copy (*args); - instance = build_non_dependent_expr (instance); - if (args != NULL) - make_args_non_dependent (*args); - } - user_args = args == NULL ? NULL : *args; /* Under DR 147 A::A() is an invalid constructor call, not a functional cast. */ @@ -9132,12 +9124,21 @@ build_new_method_call_1 (tree instance, tree fns, vec **args, return call; } + if (processing_template_decl) + { + orig_args = args == NULL ? NULL : make_tree_vector_copy (*args); + instance = build_non_dependent_expr (instance); + if (args != NULL) + make_args_non_dependent (*args); + } + /* Process the argument list. */ if (args != NULL && *args != NULL) { *args = resolve_args (*args, complain); if (*args == NULL) return error_mark_node; + user_args = *args; } /* Consider the object argument to be used even if we end up selecting a diff --git a/gcc/testsuite/g++.dg/parse/ctor10.C b/gcc/testsuite/g++.dg/parse/ctor10.C new file mode 100644 index 0000000..99d3ca8 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/ctor10.C @@ -0,0 +1,14 @@ +// PR c++/85262 +// { dg-options -fpermissive } + +struct A {}; + +template struct B : A +{ + B() + { + A::A(A()); // { dg-warning "constructor" } + } +}; + +B<0> b; -- 2.7.4