https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104846
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Marek Polacek <mpola...@gcc.gnu.org>: https://gcc.gnu.org/g:ac8310dd122172bf9d7217e3367da55f9bf9b21b commit r12-7599-gac8310dd122172bf9d7217e3367da55f9bf9b21b Author: Marek Polacek <pola...@redhat.com> Date: Wed Mar 9 11:23:15 2022 -0500 c++: ICE with operator delete [PR104846] This is an ICE-on-invalid with "auto operator delete[] (void *)" whose return type must be void. The return type is checked in coerce_delete_type but we never got there in this test, because we took the wrong path in grokdeclarator, set type to error_mark_node, ended up creating a FIELD_DECL with build_decl, and confused grokmethod by giving it a FIELD_DECL. Fixed by not taking the data member path for a FUNCTION_TYPE. PR c++/104846 gcc/cp/ChangeLog: * decl.cc (grokdeclarator): Check FUNC_OR_METHOD_TYPE_P before giving data member errors. gcc/testsuite/ChangeLog: * g++.dg/init/delete5.C: New test.