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
This commit is contained in:
Mark Mitchell 2004-02-03 17:59:58 +00:00 committed by Mark Mitchell
parent 83042fcaec
commit 3c398f341f
5 changed files with 36 additions and 1 deletions

View File

@ -1,3 +1,9 @@
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

View File

@ -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;
}

View File

@ -1,3 +1,8 @@
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

View File

@ -0,0 +1,13 @@
// PR c++/13975
public: // { dg-error "" }
int i;
protected: // { dg-error "" }
int j;
private: // { dg-error "" }
int k;

View File

@ -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);
};