This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
C++ PATCH: PR 14432
- From: Mark Mitchell <mark at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 9 Mar 2004 00:28:04 -0800
- Subject: C++ PATCH: PR 14432
- Reply-to: mark at codesourcery dot com
This is yet-another testcase where builtin functions in the user
namespace confuse us.
Tested on i686-pc-linux-gnu, applied on the mainline and on the 3.4
branch.
--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
2004-03-09 Mark Mitchell <mark@codesourcery.com>
PR c++/14432
* name-lookup.c (supplement_binding): Ignore functions that are
marked DECL_ANTICIPATED.
2004-03-09 Mark Mitchell <mark@codesourcery.com>
PR c++/14432
* g++.dg/parse/builtin2.C: New test.
Index: cp/name-lookup.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/name-lookup.c,v
retrieving revision 1.34.2.6
diff -c -5 -p -r1.34.2.6 name-lookup.c
*** cp/name-lookup.c 8 Mar 2004 19:29:53 -0000 1.34.2.6
--- cp/name-lookup.c 9 Mar 2004 08:20:18 -0000
*************** supplement_binding (cxx_binding *binding
*** 437,453 ****
timevar_push (TV_NAME_LOOKUP);
if (TREE_CODE (decl) == TYPE_DECL && DECL_ARTIFICIAL (decl))
/* The new name is the type name. */
binding->type = decl;
! else if (!bval || bval == error_mark_node)
! /* VALUE is null when push_class_level_binding moves an inherited
! type-binding out of the way to make room for a new value binding.
! It is an error_mark_node when DECL's name has been used in a
! non-class scope prior declaration. In that case, we should have
! already issued a diagnostic; for graceful error recovery purpose,
! pretend this was the intended declaration for that name. */
binding->value = decl;
else if (TREE_CODE (bval) == TYPE_DECL && DECL_ARTIFICIAL (bval))
{
/* The old binding was a type name. It was placed in
VALUE field because it was thought, at the point it was
--- 437,460 ----
timevar_push (TV_NAME_LOOKUP);
if (TREE_CODE (decl) == TYPE_DECL && DECL_ARTIFICIAL (decl))
/* The new name is the type name. */
binding->type = decl;
! else if (/* BVAL is null when push_class_level_binding moves an
! inherited type-binding out of the way to make room for a
! new value binding. */
! !bval
! /* BVAL is error_mark_node when DECL's name has been used
! in a non-class scope prior declaration. In that case,
! we should have already issued a diagnostic; for graceful
! error recovery purpose, pretend this was the intended
! declaration for that name. */
! || bval == error_mark_node
! /* If BVAL is a built-in that has not yet been declared,
! pretend it is not there at all. */
! || (TREE_CODE (bval) == FUNCTION_DECL
! && DECL_ANTICIPATED (bval)))
binding->value = decl;
else if (TREE_CODE (bval) == TYPE_DECL && DECL_ARTIFICIAL (bval))
{
/* The old binding was a type name. It was placed in
VALUE field because it was thought, at the point it was
Index: testsuite/g++.dg/parse/builtin2.C
===================================================================
RCS file: testsuite/g++.dg/parse/builtin2.C
diff -N testsuite/g++.dg/parse/builtin2.C
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- testsuite/g++.dg/parse/builtin2.C 9 Mar 2004 08:20:21 -0000
***************
*** 0 ****
--- 1,5 ----
+ // PR c++/14432
+ // { dg-options "" }
+
+ struct Y {};
+ Y y1;