OSDN Git Service

detect C++ errors to fix 2288 and 18770
authorfroydnj <froydnj@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 26 May 2011 20:15:22 +0000 (20:15 +0000)
committerfroydnj <froydnj@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 26 May 2011 20:15:22 +0000 (20:15 +0000)
commit16878d888f44259ff45d5037539f91358d4db8fe
treed67de4f1d33d599df36d693a0e3561ed970648d6
parent2494d261a92a20173efdaeefae00bace5d217115
detect C++ errors to fix 2288 and 18770
gcc/cp/
PR c++/2288
PR c++/18770
* name-lookup.h (enum scope_kind): Add sk_cond.
* name-lookup.c (pushdecl_maybe_friend): Get scope of shadowed local.
Detect and report error for redeclaration from for-init or if
or switch condition.
(begin_scope): Handle sk_cond.
* semantics.c (begin_if_stmt): Use sk_cond.
(begin switch_stmt): Ditto.
gcc/testsuite/
PR c++/2288
PR c++/18770
* g++.old-deja/g++.jason/cond.C: Remove xfails.
* g++.dg/parse/pr18770.C: New test.
* g++.dg/cpp0x/range-for5.C: Add dg-error marker.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@174307 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/cp/ChangeLog
gcc/cp/name-lookup.c
gcc/cp/name-lookup.h
gcc/cp/semantics.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/range-for5.C
gcc/testsuite/g++.dg/parse/pr18770.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.jason/cond.C