diff mbox

[C++] PR 58700

Message ID 5259F8BF.9050902@oracle.com
State New
Headers show

Commit Message

Paolo Carlini Oct. 13, 2013, 1:34 a.m. UTC
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.carlini@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.carlini@oracle.com>

	PR c++/58700
	* g++.dg/parse/bitfield4.C: New.

Comments

Jason Merrill Nov. 23, 2013, 10:39 p.m. UTC | #1
On 10/12/2013 09:34 PM, Paolo Carlini wrote:
> 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.

OK.

Jason
diff mbox

Patch

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" }
+};