summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2013-11-26 11:31:46 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2013-11-26 11:31:46 +0000
commitca72c6bb11fe2d73c5ec8b636b83cf4ea997ea35 (patch)
tree13e164da63cd1da14692d15373780596a810b033
parente6b6acd098a816eda98babd57ed2f3f29c41d868 (diff)
downloadgcc-ca72c6bb11fe2d73c5ec8b636b83cf4ea997ea35.tar.gz
/cp
2013-11-26 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-11-26 Paolo Carlini <paolo.carlini@oracle.com> PR c++/58700 * g++.dg/parse/bitfield4.C: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205389 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/decl.c4
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/parse/bitfield4.C6
4 files changed, 20 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 143885cea1c..604f26dc14b 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,11 @@
2013-11-26 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.
+
+2013-11-26 Paolo Carlini <paolo.carlini@oracle.com>
+
* cvt.c (cp_convert_and_check): Avoid calling cp_convert
unnecessarily.
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index bf4d8e3d684..9508131388f 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -10637,7 +10637,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
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 25d88733d2c..6639f05d542 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2013-11-26 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/58700
+ * g++.dg/parse/bitfield4.C: New.
+
2013-11-26 Richard Biener <rguenther@suse.de>
PR tree-optimization/59287
diff --git a/gcc/testsuite/g++.dg/parse/bitfield4.C b/gcc/testsuite/g++.dg/parse/bitfield4.C
new file mode 100644
index 00000000000..e10fa5f3342
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/bitfield4.C
@@ -0,0 +1,6 @@
+// PR c++/58700
+
+struct A
+{
+ static int : 4; // { dg-error "bit-field" }
+};