The following C++ code causes an ICE in GCC 8.0.1 20180308 (tested with https://godbolt.org/): /********************** SOURCE **********************/ template<typename T> struct S { static constexpr T value = 0; }; constexpr auto x = S<void(*)(auto)>::value; /******************** END SOURCE ********************/ /********************** OUTPUT **********************/ <source>:6:38: internal compiler error: Segmentation fault constexpr auto x = S<void(*)(auto)>::value; ^~~~~ mmap: Invalid argument Please submit a full bug report, with preprocessed source if appropriate. See <https://gcc.gnu.org/bugs/> for instructions. Compiler returned: 1 /******************** END OUTPUT ********************/ The same problem appears to exist in all versions since GCC 6.1.
Confirmed.
Started with r202540. Before that: error: parameter declared ‘auto’ constexpr auto x = S<void(*)(auto)>::value; ^
Is auto valid among parameters except for generic lambdas?
Outside of lambdas the patch essentially changed an error diagnostic to else if (cxx_dialect < cxx1y) pedwarn (location_of (type), 0, "use of %<auto%> in parameter declaration " "only available with " "-std=c++1y or -std=gnu++1y"); else pedwarn (location_of (type), OPT_Wpedantic, "ISO C++ forbids use of %<auto%> in parameter " "declaration"); Do we really want that extension and what uses it?
*** Bug 84840 has been marked as a duplicate of this bug. ***
Author: jason Date: Tue Mar 13 15:55:07 2018 New Revision: 258493 URL: https://gcc.gnu.org/viewcvs?rev=258493&root=gcc&view=rev Log: PR c++/84798 - ICE with auto in abstract function declarator. * parser.c (cp_parser_parameter_declaration_clause): Check parser->default_arg_ok_p. Added: trunk/gcc/testsuite/g++.dg/cpp0x/auto51.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/parser.c trunk/gcc/testsuite/g++.dg/cpp1y/pr60393.C
*** Bug 84541 has been marked as a duplicate of this bug. ***
*** Bug 79525 has been marked as a duplicate of this bug. ***
Author: jason Date: Fri Mar 23 14:39:30 2018 New Revision: 258809 URL: https://gcc.gnu.org/viewcvs?rev=258809&root=gcc&view=rev Log: PR c++/84798 - ICE with auto in abstract function declarator. * parser.c (cp_parser_parameter_declaration_clause): Check parser->default_arg_ok_p. Added: branches/gcc-7-branch/gcc/testsuite/g++.dg/cpp0x/auto-60626.C branches/gcc-7-branch/gcc/testsuite/g++.dg/cpp0x/auto51.C Removed: branches/gcc-7-branch/gcc/testsuite/g++.dg/cpp1y/pr60626.C Modified: branches/gcc-7-branch/gcc/cp/ChangeLog branches/gcc-7-branch/gcc/cp/parser.c branches/gcc-7-branch/gcc/testsuite/g++.dg/cpp1y/pr60393.C
Fixed for 7.4/8.
Verified.