re PR c++/26269 (Declaring a variable too late yields bogus error message)

PR c++/26269
        * decl.c (duplicate_decls): Return early if either
        newdecl or olddecl is error_mark_node.

        * g++.dg/other/error14.C: New test.

From-SVN: r116301
This commit is contained in:
Lee Millward 2006-08-21 17:27:48 +00:00 committed by Lee Millward
parent 85d89e767b
commit 18ff35c669
4 changed files with 19 additions and 1 deletions

View file

@ -1,3 +1,9 @@
2006-08-21 Lee Millward <lee.millward@codesourcery.com>
PR c++/26269
* decl.c (duplicate_decls): Return early if either
newdecl or olddecl is error_mark_node.
2006-08-20 Mark Mitchell <mark@codesourcery.com>
PR c++/28341

View file

@ -1124,7 +1124,7 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
about the same declaration, so just pretend the types match here. */
if (TREE_TYPE (newdecl) == error_mark_node
|| TREE_TYPE (olddecl) == error_mark_node)
types_match = 1;
return error_mark_node.
if (DECL_P (olddecl)
&& TREE_CODE (newdecl) == FUNCTION_DECL

View file

@ -1,3 +1,8 @@
2006-08-21 Lee Millward <lee.millward@codesourcery.com>
PR c++/26269
* g++.dg/other/error14.C: New test.
2006-08-21 Olivier Hainque <hainque@adacore.com>
* gnat.dg/self_aggregate_with_zeros.adb: New test.

View file

@ -0,0 +1,7 @@
//PR c++/26269
void foo()
{
i; // { dg-error "not declared in this scope" }
int i;
}