From: Mark Mitchell Date: Tue, 3 Feb 2004 17:59:58 +0000 (+0000) Subject: re PR c++/14002 (Friend declaration with template-id causes confusion of function... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3c398f341f8144ca380fc8820ab23d6cace90445;p=gcc.git 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 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 221fbe627a9..a4c9c816ae3 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2004-02-03 Mark Mitchell + + 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 PR c++/13978 diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 5b1b1ef4d1c..511c7bc9348 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 a746adb2583..b08666a3ba1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2004-02-03 Mark Mitchell + + PR c++/14002 + * g++.dg/parse/template13.C: New test. + 2004-02-03 Mark Mitchell PR c++/13978 diff --git a/gcc/testsuite/g++.dg/parse/error13.C b/gcc/testsuite/g++.dg/parse/error13.C new file mode 100644 index 00000000000..15642e39ed7 --- /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 00000000000..b1c03690be5 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/template13.C @@ -0,0 +1,10 @@ +// PR c++/14002 + +template void foo (T x) { x; } + +void bar() { foo(0); } + +struct A +{ + friend void foo (int); +};