diff options
author | Jakub Jelinek <jakub@redhat.com> | 2018-11-21 23:42:09 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2018-11-21 23:42:09 +0100 |
commit | 208a53290430fc17e801c7cc8f0f0289184a2d86 (patch) | |
tree | 9db02bb9b40cea390e3ac919bdee2797dae8ff4c /gcc | |
parent | e1389417f9bc364b49f8bef9583e34a8db3a4049 (diff) | |
download | gcc-208a53290430fc17e801c7cc8f0f0289184a2d86.zip gcc-208a53290430fc17e801c7cc8f0f0289184a2d86.tar.gz gcc-208a53290430fc17e801c7cc8f0f0289184a2d86.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/method.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/implicit15.C | 11 |
4 files changed, 25 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9305d53..ad061f2 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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. diff --git a/gcc/cp/method.c b/gcc/cp/method.c index 435ba1d..936dad4 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bb61952..afd928e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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. diff --git a/gcc/testsuite/g++.dg/cpp0x/implicit15.C b/gcc/testsuite/g++.dg/cpp0x/implicit15.C new file mode 100644 index 0000000..40fadaf --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/implicit15.C @@ -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" } |