re PR c++/15862 ('enum yn' fails)
authorMark Mitchell <mark@codesourcery.com>
Fri, 11 Jun 2004 18:14:52 +0000 (18:14 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Fri, 11 Jun 2004 18:14:52 +0000 (18:14 +0000)
PR c++/15862
* name-lookup.c (unqualified_namespace_lookup): Do not ignore type
bindings for undeclared built-ins.

PR c++/15862
* g++.dg/parse/enum1.C: New test.

From-SVN: r82986

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

index 6ab2a7a5ce7226d5322cde947c9bcf29c7fa4526..4b4e42c95c944831acde4c52fa0c81082782a248 100644 (file)
@@ -1,3 +1,9 @@
+2004-06-11  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/15862
+       * name-lookup.c (unqualified_namespace_lookup): Do not ignore type
+       bindings for undeclared built-ins.
+
 2004-06-11  Giovanni Bajo  <giovannibajo@gcc.gnu.org>
 
        * typeck2.c (abstract_virtual_errors): Reword diagnostics, make them
index 238023da87754fe80726356570a9e79bad40e25d..d470251d3170eb621d82c2d0cc67f12181a5fbbf 100644 (file)
@@ -3761,16 +3761,17 @@ unqualified_namespace_lookup (tree name, int flags)
       cxx_binding *b =
          cxx_scope_find_binding_for_name (NAMESPACE_LEVEL (scope), name);
 
-      /* Ignore anticipated built-in functions.  */
-      if (b && b->value && DECL_P (b->value)
-          && DECL_LANG_SPECIFIC (b->value) && DECL_ANTICIPATED (b->value))
-        /* Keep binding cleared.  */;
-      else if (b)
-        {
-          /* Initialize binding for this context.  */
-          binding.value = b->value;
-          binding.type = b->type;
-        }
+      if (b)
+       {
+         if (b->value && DECL_P (b->value)
+             && DECL_LANG_SPECIFIC (b->value) 
+             && DECL_ANTICIPATED (b->value))
+           /* Ignore anticipated built-in functions.  */
+           ;
+         else
+           binding.value = b->value;
+         binding.type = b->type;
+       }
 
       /* Add all _DECLs seen through local using-directives.  */
       for (level = current_binding_level;
index e980a438ed592997f039382192bf11d7030feb5b..8fc34ba9d6840c3aca94c99c644cc1e067b7a10f 100644 (file)
@@ -1,3 +1,8 @@
+2004-06-11  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/15862
+       * g++.dg/parse/enum1.C: New test.
+
 2004-06-10  Jeff Law  <law@redhat.com>
 
        * gcc.c-torture/compile/20040610-1.c: New test.
diff --git a/gcc/testsuite/g++.dg/parse/enum1.C b/gcc/testsuite/g++.dg/parse/enum1.C
new file mode 100644 (file)
index 0000000..d5c5f86
--- /dev/null
@@ -0,0 +1,4 @@
+// PR c++/15862
+
+enum yn { Y, N };
+enum yn x = Y;