aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2004-06-11 18:14:52 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2004-06-11 18:14:52 +0000
commitba18e4dbfc7e018c9b313cfc3fea93592880bc41 (patch)
tree3a88e5e64afa9c690c328f36beb93348389ef616
parente6ff425c0064f00c28315bdfa2624f556af17a2e (diff)
downloadgcc-ba18e4dbfc7e018c9b313cfc3fea93592880bc41.zip
gcc-ba18e4dbfc7e018c9b313cfc3fea93592880bc41.tar.gz
gcc-ba18e4dbfc7e018c9b313cfc3fea93592880bc41.tar.bz2
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
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/name-lookup.c21
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/parse/enum1.C4
4 files changed, 26 insertions, 10 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 6ab2a7a..4b4e42c 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 238023d..d470251 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 e980a43..8fc34ba 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 0000000..d5c5f86
--- /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;