aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2004-02-03 17:59:58 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2004-02-03 17:59:58 +0000
commit3c398f341f8144ca380fc8820ab23d6cace90445 (patch)
tree64c2d418be47ee0413e8586849d3a385799239e5 /gcc
parent83042fcaec9b5763ddc895a57c6618afbfc4c897 (diff)
downloadgcc-3c398f341f8144ca380fc8820ab23d6cace90445.zip
gcc-3c398f341f8144ca380fc8820ab23d6cace90445.tar.gz
gcc-3c398f341f8144ca380fc8820ab23d6cace90445.tar.bz2
re PR c++/14002 (Friend declaration with template-id causes confusion of function arguments)
PR c++/14002 * semantics.c (finish_id_expression): Do not return an IDENTIFIER_NODE when lookup finds a PARM_DECL. PR c++/14002 * g++.dg/parse/template13.C: New test. From-SVN: r77183
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/semantics.c3
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/parse/error13.C13
-rw-r--r--gcc/testsuite/g++.dg/parse/template13.C10
5 files changed, 36 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 221fbe6..a4c9c81 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,11 @@
2004-02-03 Mark Mitchell <mark@codesourcery.com>
+ PR c++/14002
+ * semantics.c (finish_id_expression): Do not return an
+ IDENTIFIER_NODE when lookup finds a PARM_DECL.
+
+2004-02-03 Mark Mitchell <mark@codesourcery.com>
+
PR c++/13978
* pt.c (build_non_dependent_expr): Do not build
NON_DEPENDENT_EXPRs for FUNCTION_DECLs or TEMPLATE_DECLs.
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 5b1b1ef4..511c7bc 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -2527,7 +2527,8 @@ finish_id_expression (tree id_expression,
/* If we found a variable, then name lookup during the
instantiation will always resolve to the same VAR_DECL
(or an instantiation thereof). */
- if (TREE_CODE (decl) == VAR_DECL)
+ if (TREE_CODE (decl) == VAR_DECL
+ || TREE_CODE (decl) == PARM_DECL)
return decl;
return id_expression;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index a746adb..b08666a 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2004-02-03 Mark Mitchell <mark@codesourcery.com>
+ PR c++/14002
+ * g++.dg/parse/template13.C: New test.
+
+2004-02-03 Mark Mitchell <mark@codesourcery.com>
+
PR c++/13978
* g++.dg/template/koenig4.C: New test.
diff --git a/gcc/testsuite/g++.dg/parse/error13.C b/gcc/testsuite/g++.dg/parse/error13.C
new file mode 100644
index 0000000..15642e3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/error13.C
@@ -0,0 +1,13 @@
+// PR c++/13975
+
+public: // { dg-error "" }
+
+int i;
+
+protected: // { dg-error "" }
+
+int j;
+
+private: // { dg-error "" }
+
+int k;
diff --git a/gcc/testsuite/g++.dg/parse/template13.C b/gcc/testsuite/g++.dg/parse/template13.C
new file mode 100644
index 0000000..b1c0369
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/template13.C
@@ -0,0 +1,10 @@
+// PR c++/14002
+
+template <typename T> void foo (T x) { x; }
+
+void bar() { foo(0); }
+
+struct A
+{
+ friend void foo<int> (int);
+};