diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6fd125ab1d4..366aa69f858 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2006-08-21 Lee Millward + + PR c++/26269 + * decl.c (duplicate_decls): Return early if either + newdecl or olddecl is error_mark_node. + 2006-08-20 Mark Mitchell PR c++/28341 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index a8ec398e1ff..b67aea76a78 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -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 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d6e011ce9b4..d61c5ae9fd9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2006-08-21 Lee Millward + + PR c++/26269 + * g++.dg/other/error14.C: New test. + 2006-08-21 Olivier Hainque * gnat.dg/self_aggregate_with_zeros.adb: New test. diff --git a/gcc/testsuite/g++.dg/other/error14.C b/gcc/testsuite/g++.dg/other/error14.C new file mode 100644 index 00000000000..b3c930188e3 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/error14.C @@ -0,0 +1,7 @@ +//PR c++/26269 + +void foo() +{ + i; // { dg-error "not declared in this scope" } + int i; +}