aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2004-03-11 04:25:38 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2004-03-11 04:25:38 +0000
commite46e9f822e035f84349a34ae4dce020c98c30da5 (patch)
tree2c249462a7b41eac1808184c0257c44f19da0edf
parent4d0c31e68cc2a1c3d39c7d51d2af9cd3d5c1784f (diff)
downloadgcc-e46e9f822e035f84349a34ae4dce020c98c30da5.zip
gcc-e46e9f822e035f84349a34ae4dce020c98c30da5.tar.gz
gcc-e46e9f822e035f84349a34ae4dce020c98c30da5.tar.bz2
re PR c++/14510 (Lookup error between function name and struct name)
PR c++/14510 * decl.c (xref_tag): Disregard non-type declarations when looking up a tagged type. PR c++/14510 * g++.dg/lookup/struct2.C: New test. From-SVN: r79298
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/decl.c2
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/lookup/struct2.C7
4 files changed, 19 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index a0d2b06..f746718 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2004-03-10 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/14510
+ * decl.c (xref_tag): Disregard non-type declarations when
+ looking up a tagged type.
+
2004-03-09 Nathan Sidwell <nathan@codesourcery.com>
PR c++/14397
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index c2698ec..e642c26 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -9305,7 +9305,7 @@ xref_tag (enum tag_types tag_code, tree name,
}
else
{
- tree decl = lookup_name (name, 1);
+ tree decl = lookup_name (name, 2);
if (decl && DECL_CLASS_TEMPLATE_P (decl))
decl = DECL_TEMPLATE_RESULT (decl);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 21b2f05..df12379 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2004-03-10 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/14510
+ * g++.dg/lookup/struct2.C: New test.
+
2004-03-10 Uros Bizjak <uros@kss-loka.si>
* gcc.dg/builtins-34.c: New test.
diff --git a/gcc/testsuite/g++.dg/lookup/struct2.C b/gcc/testsuite/g++.dg/lookup/struct2.C
new file mode 100644
index 0000000..a66f403
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lookup/struct2.C
@@ -0,0 +1,7 @@
+// PR c++/14510
+
+struct c {};
+namespace A {
+ int c(struct c*req);
+}
+int A::c(struct c*req) {}