From ba18e4dbfc7e018c9b313cfc3fea93592880bc41 Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Fri, 11 Jun 2004 18:14:52 +0000 Subject: [PATCH] re PR c++/15862 ('enum yn' fails) 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 | 6 ++++++ gcc/cp/name-lookup.c | 21 +++++++++++---------- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/parse/enum1.C | 4 ++++ 4 files changed, 26 insertions(+), 10 deletions(-) create mode 100644 gcc/testsuite/g++.dg/parse/enum1.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6ab2a7a5ce72..4b4e42c95c94 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2004-06-11 Mark Mitchell + + PR c++/15862 + * name-lookup.c (unqualified_namespace_lookup): Do not ignore type + bindings for undeclared built-ins. + 2004-06-11 Giovanni Bajo * typeck2.c (abstract_virtual_errors): Reword diagnostics, make them diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index 238023da8775..d470251d3170 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e980a438ed59..8fc34ba9d684 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2004-06-11 Mark Mitchell + + PR c++/15862 + * g++.dg/parse/enum1.C: New test. + 2004-06-10 Jeff Law * 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 index 000000000000..d5c5f8688c8c --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/enum1.C @@ -0,0 +1,4 @@ +// PR c++/15862 + +enum yn { Y, N }; +enum yn x = Y; -- 2.43.5