aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2003-12-16 01:15:14 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2003-12-16 01:15:14 +0000
commitea0e2a51f400471a67bf3979fb9e30390eb7a34b (patch)
tree03f06373df56eb113ab148c998294466b7c4e440 /gcc
parent48b5158caa2376635b00ff72ea8946b461645696 (diff)
downloadgcc-ea0e2a51f400471a67bf3979fb9e30390eb7a34b.zip
gcc-ea0e2a51f400471a67bf3979fb9e30390eb7a34b.tar.gz
gcc-ea0e2a51f400471a67bf3979fb9e30390eb7a34b.tar.bz2
re PR c++/12989 ([new parser] internal compiler error: tree check: expected field_decl)
PR c++/12989 * typeck.c (cxx_sizeof_or_alignof_expr): Robustify. PR c++/12989 * g++.dg/expr/sizeof1.C: New test. From-SVN: r74660
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/typeck.c1
-rw-r--r--gcc/testsuite/ChangeLog3
-rw-r--r--gcc/testsuite/g++.dg/expr/sizeof1.C7
4 files changed, 14 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 60bfd41..43389e8 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,8 @@
2003-12-15 Mark Mitchell <mark@codesourcery.com>
+ PR c++/12989
+ * typeck.c (cxx_sizeof_or_alignof_expr): Robustify.
+
PR c++/13310
* pt.c (dependent_template_p): Handle OVERLOADs.
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index f2cca5f..791ba21 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -1233,6 +1233,7 @@ cxx_sizeof_or_alignof_expr (tree e, enum tree_code op)
}
if (TREE_CODE (e) == COMPONENT_REF
+ && TREE_CODE (TREE_OPERAND (e, 1)) == FIELD_DECL
&& DECL_C_BIT_FIELD (TREE_OPERAND (e, 1)))
{
error ("invalid application of `%s' to a bit-field", op_name);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 941809d..83352dc 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,8 @@
2003-12-15 Mark Mitchell <mark@codesourcery.com>
+ PR c++/12989
+ * g++.dg/expr/sizeof1.C: New test.
+
PR c++/13310
* g++.dg/template/crash15.C: New test.
diff --git a/gcc/testsuite/g++.dg/expr/sizeof1.C b/gcc/testsuite/g++.dg/expr/sizeof1.C
new file mode 100644
index 0000000..fa84481
--- /dev/null
+++ b/gcc/testsuite/g++.dg/expr/sizeof1.C
@@ -0,0 +1,7 @@
+// PR c++/12989
+
+struct A
+{
+ int foo() { return sizeof(bar); } // { dg-error "" }
+ int bar();
+};