Hi,
this ICE on invalid, a 4.8/4.9 Regression, simply started when
build_lang_decl_loc was introduced, which wants a location as first
argument: when the declarator is null, we can't pass the location as
declarator->id_loc. For now input_location can do, I think, restores the
old behavior.
Tested x86_64-linux.
Thanks,
Paolo.
/////////////////////
/cp
2013-10-14 Paolo Carlini <paolo.carl...@oracle.com>
PR c++/58700
* decl.c (grokdeclarator): Don't try to pass declarator->id_loc
to build_lang_decl_loc when declarator is null.
/testsuite
2013-10-14 Paolo Carlini <paolo.carl...@oracle.com>
PR c++/58700
* g++.dg/parse/bitfield4.C: New.
Index: cp/decl.c
===================================================================
--- cp/decl.c (revision 203495)
+++ cp/decl.c (working copy)
@@ -10638,7 +10638,9 @@ grokdeclarator (const cp_declarator *declarator,
{
/* C++ allows static class members. All other work
for this is done by grokfield. */
- decl = build_lang_decl_loc (declarator->id_loc,
+ decl = build_lang_decl_loc (declarator
+ ? declarator->id_loc
+ : input_location,
VAR_DECL, unqualified_id, type);
set_linkage_for_static_data_member (decl);
/* Even if there is an in-class initialization, DECL
Index: testsuite/g++.dg/parse/bitfield4.C
===================================================================
--- testsuite/g++.dg/parse/bitfield4.C (revision 0)
+++ testsuite/g++.dg/parse/bitfield4.C (working copy)
@@ -0,0 +1,6 @@
+// PR c++/58700
+
+struct A
+{
+ static int : 4; // { dg-error "bit-field" }
+};