re PR c++/14432 (Built-ins lead to conflict even if no header file included)
authorMark Mitchell <mark@codesourcery.com>
Tue, 9 Mar 2004 08:26:14 +0000 (08:26 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Tue, 9 Mar 2004 08:26:14 +0000 (08:26 +0000)
PR c++/14432
* name-lookup.c (supplement_binding): Ignore functions that are
marked DECL_ANTICIPATED.

PR c++/14432
* g++.dg/parse/builtin2.C: New test.

From-SVN: r79160

gcc/cp/ChangeLog
gcc/cp/name-lookup.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/parse/builtin2.C [new file with mode: 0644]

index 21ca2f959158c37f5a7a45ae68a9980d5a068306..2f684b4c1fe12e4717207c6e723d855a923b1324 100644 (file)
@@ -1,3 +1,9 @@
+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-08  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/14401
index 82e583c3351fa595fda780fb40a5d96f513ca7f2..ce101de168c4ffe559d9c7812988a355bf1da9ce 100644 (file)
@@ -439,13 +439,20 @@ supplement_binding (cxx_binding *binding, tree decl)
   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.  */
+  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))
     {
index 6eb9b55d76d83a834b6c4992b2ae9afe9094e461..8e55c0e3ab44c5916c247170f4817bae3d22911f 100644 (file)
@@ -1,3 +1,8 @@
+2004-03-09  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/14432
+       * g++.dg/parse/builtin2.C: New test.
+
 2004-03-08  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/14401
diff --git a/gcc/testsuite/g++.dg/parse/builtin2.C b/gcc/testsuite/g++.dg/parse/builtin2.C
new file mode 100644 (file)
index 0000000..c524ea6
--- /dev/null
@@ -0,0 +1,5 @@
+// PR c++/14432
+// { dg-options "" }
+
+struct Y {}; 
+Y y1;