aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2018-11-28 20:03:06 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2018-11-28 20:03:06 +0000
commitbdd0bd5c96a1f3a51bcfe0cc5b0ffd3ff6f0280e (patch)
tree97c0fdde49806edb0cf7145c7a8c9ea7124efbc4 /gcc
parent9638e3ef166cc37204143905bd8bec82a1f42437 (diff)
downloadgcc-bdd0bd5c96a1f3a51bcfe0cc5b0ffd3ff6f0280e.zip
gcc-bdd0bd5c96a1f3a51bcfe0cc5b0ffd3ff6f0280e.tar.gz
gcc-bdd0bd5c96a1f3a51bcfe0cc5b0ffd3ff6f0280e.tar.bz2
PR c++/88222 - ICE with bit-field with invalid type.
* decl.c (grokdeclarator): Check if declarator is null. * g++.dg/ext/flexary31.C: New test. From-SVN: r266581
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/decl.c2
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/ext/flexary31.C8
4 files changed, 19 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index c0f04d5..1897c2f 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2018-11-28 Marek Polacek <polacek@redhat.com>
+
+ PR c++/88222 - ICE with bit-field with invalid type.
+ * decl.c (grokdeclarator): Check if declarator is null.
+
2018-11-28 Jakub Jelinek <jakub@redhat.com>
PR c++/87476
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 1aaf517..3734bfe 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -12221,7 +12221,7 @@ grokdeclarator (const cp_declarator *declarator,
if (in_system_header_at (input_location))
/* Do not warn on flexible array members in system
headers because glibc uses them. */;
- else if (name)
+ else if (name && declarator)
pedwarn (declarator->id_loc, OPT_Wpedantic,
"ISO C++ forbids flexible array member %qs", name);
else
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 86bc7c7..fd76bc7 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2018-11-28 Marek Polacek <polacek@redhat.com>
+
+ PR c++/88222 - ICE with bit-field with invalid type.
+ * g++.dg/ext/flexary31.C: New test.
+
2018-11-28 David Edelsohn <dje.gcc@gmail.com>
* g++.dg/debug/dwarf2/pr86900.C: XFAIL AIX.
diff --git a/gcc/testsuite/g++.dg/ext/flexary31.C b/gcc/testsuite/g++.dg/ext/flexary31.C
new file mode 100644
index 0000000..90f8431
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/flexary31.C
@@ -0,0 +1,8 @@
+// PR c++/88222
+// { dg-options -Wno-pedantic }
+
+typedef char a[];
+
+class S {
+ a : 4; // { dg-error "bit-field" }
+};