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
This commit is contained in:
Mark Mitchell 2003-12-16 01:15:14 +00:00 committed by Mark Mitchell
parent 48b5158caa
commit ea0e2a51f4
4 changed files with 14 additions and 0 deletions

View File

@ -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.

View File

@ -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);

View File

@ -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.

View File

@ -0,0 +1,7 @@
// PR c++/12989
struct A
{
int foo() { return sizeof(bar); } // { dg-error "" }
int bar();
};