This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
C++ PATCH: PR c++/14002
- From: Mark Mitchell <mark at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 3 Feb 2004 10:00:27 -0800
- Subject: C++ PATCH: PR c++/14002
- Reply-to: mark at codesourcery dot com
This patch fixes the PARM_DECL version of PR c++/13968, which was the
VAR_DECL version.
Tested on i686-pc-linux-gnu, applied on the mainline and on the
branch.
--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
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++/14002
* g++.dg/parse/template13.C: New test.
Index: cp/semantics.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/semantics.c,v
retrieving revision 1.381.4.6
diff -c -5 -p -r1.381.4.6 semantics.c
*** cp/semantics.c 3 Feb 2004 16:12:31 -0000 1.381.4.6
--- cp/semantics.c 3 Feb 2004 17:55:21 -0000
*************** finish_id_expression (tree id_expression
*** 2525,2535 ****
*non_integral_constant_expression_p = true;
*idk = CP_ID_KIND_UNQUALIFIED_DEPENDENT;
/* 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)
return decl;
return id_expression;
}
/* Only certain kinds of names are allowed in constant
--- 2525,2536 ----
*non_integral_constant_expression_p = true;
*idk = CP_ID_KIND_UNQUALIFIED_DEPENDENT;
/* 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
! || TREE_CODE (decl) == PARM_DECL)
return decl;
return id_expression;
}
/* Only certain kinds of names are allowed in constant
Index: testsuite/g++.dg/parse/template13.C
===================================================================
RCS file: testsuite/g++.dg/parse/template13.C
diff -N testsuite/g++.dg/parse/template13.C
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- testsuite/g++.dg/parse/template13.C 3 Feb 2004 17:57:45 -0000
***************
*** 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);
+ };