re PR c++/88122 (g++ ICE: internal compiler error: Segmentation fault)

PR c++/88122
	* method.c (maybe_explain_implicit_delete): If
	FUNCTION_FIRST_USER_PARMTYPE (decl) is NULL, set const_p to false
	instead of ICEing.

	* g++.dg/cpp0x/implicit15.C: New test.

From-SVN: r266360
This commit is contained in:
Jakub Jelinek 2018-11-21 23:42:09 +01:00 committed by Jakub Jelinek
parent e1389417f9
commit 208a532904
4 changed files with 25 additions and 2 deletions

View File

@ -1,5 +1,10 @@
2018-11-21 Jakub Jelinek <jakub@redhat.com>
PR c++/88122
* method.c (maybe_explain_implicit_delete): If
FUNCTION_FIRST_USER_PARMTYPE (decl) is NULL, set const_p to false
instead of ICEing.
PR c++/87386
* parser.c (cp_parser_primary_expression): Use
id_expression.get_location () instead of id_expr_token->location.

View File

@ -1821,8 +1821,12 @@ maybe_explain_implicit_delete (tree decl)
if (!informed)
{
tree parms = FUNCTION_FIRST_USER_PARMTYPE (decl);
tree parm_type = TREE_VALUE (parms);
bool const_p = CP_TYPE_CONST_P (non_reference (parm_type));
bool const_p = false;
if (parms)
{
tree parm_type = TREE_VALUE (parms);
const_p = CP_TYPE_CONST_P (non_reference (parm_type));
}
tree raises = NULL_TREE;
bool deleted_p = false;
tree scope = push_scope (ctype);

View File

@ -1,5 +1,8 @@
2018-11-21 Jakub Jelinek <jakub@redhat.com>
PR c++/88122
* g++.dg/cpp0x/implicit15.C: New test.
PR c++/87386
* g++.dg/diagnostic/pr87386.C: New test.
* g++.dg/parse/error17.C: Adjust expected diagnostics.

View File

@ -0,0 +1,11 @@
// PR c++/88122
// { dg-do compile { target c++11 } }
struct A {
A (...); // { dg-message "candidate" }
A (); // { dg-message "candidate" }
};
struct B : A {
using A::A; // { dg-error "is ambiguous" }
// { dg-message "is implicitly deleted because the default definition would be ill-formed" "" { target *-*-* } .-1 }
} b{3}; // { dg-error "use of deleted function" }