===================================================================
@@ -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
===================================================================
@@ -0,0 +1,6 @@
+// PR c++/58700
+
+struct A
+{
+ static int : 4; // { dg-error "bit-field" }
+};