From: paolo Date: Tue, 4 Dec 2018 23:48:45 +0000 (+0000) Subject: /cp X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=659e7be1830fb5e3ae07835ad3e883944840427b;p=thirdparty%2Fgcc.git /cp 2018-12-04 Paolo Carlini PR c++/84636 * decl.c (grokdeclarator): Avoid crashing on an anonymous bit-field with function type. /testsuite 2018-12-04 Paolo Carlini PR c++/84636 * g++.dg/parse/bitfield6.C: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@266807 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d43d6132d340..253af3ba1347 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2018-12-04 Paolo Carlini + + PR c++/84636 + * decl.c (grokdeclarator): Avoid crashing on an anonymous bit-field + with function type. + 2018-12-04 Marek Polacek PR c++/88184 - ICE when treating name as template-name. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 7d2c599a5573..e662f63bb0f0 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -12187,7 +12187,8 @@ grokdeclarator (const cp_declarator *declarator, } if (ctype && TREE_CODE (type) == FUNCTION_TYPE && staticp < 2 - && !(identifier_p (unqualified_id) + && !(unqualified_id + && identifier_p (unqualified_id) && IDENTIFIER_NEWDEL_OP_P (unqualified_id))) { cp_cv_quals real_quals = memfn_quals; @@ -12267,8 +12268,7 @@ grokdeclarator (const cp_declarator *declarator, error ("invalid use of %<::%>"); return error_mark_node; } - else if (TREE_CODE (type) == FUNCTION_TYPE - || TREE_CODE (type) == METHOD_TYPE) + else if (FUNC_OR_METHOD_TYPE_P (type) && unqualified_id) { int publicp = 0; tree function_context; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c1b1bc49e391..d02b6f372359 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-12-04 Paolo Carlini + + PR c++/84636 + * g++.dg/parse/bitfield6.C: New. + 2018-12-04 Jakub Jelinek PR tree-optimization/87320 diff --git a/gcc/testsuite/g++.dg/parse/bitfield6.C b/gcc/testsuite/g++.dg/parse/bitfield6.C new file mode 100644 index 000000000000..dad0b681c66c --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/bitfield6.C @@ -0,0 +1,6 @@ +// PR c++/84636 + +typedef void a(); +struct A { +a: 1; // { dg-error "bit-field .\\. with non-integral type" } +};