This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
C++ PATCH: PR 9727
- From: Mark Mitchell <mark at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 21 Feb 2003 13:43:09 -0800
- Subject: C++ PATCH: PR 9727
- Reply-to: mark at codesourcery dot com
This patch fixes PR 9727, a 3.3 regression, by backporting some code
from the mainline.
Tested on i686-pc-linux-gnu, applied on the branch.
--
Mark Mitchell mark at codesourcery dot com
CodeSourcery, LLC http://www.codesourcery.com
2003-02-21 Mark Mitchell <mark at codesourcery dot com>
PR c++/9727
* decl2.c (push_scope): Don't pushclass for non-class types.
(pop_scope): Don't popclass either.
2003-02-21 Mark Mitchell <mark at codesourcery dot com>
PR c++/9727
* g++.dg/template/op1.C: New test.
Index: cp/decl2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl2.c,v
retrieving revision 1.575.2.8
diff -c -5 -p -r1.575.2.8 decl2.c
*** cp/decl2.c 21 Feb 2003 20:22:06 -0000 1.575.2.8
--- cp/decl2.c 21 Feb 2003 21:43:28 -0000
*************** void
*** 4032,4042 ****
push_scope (t)
tree t;
{
if (TREE_CODE (t) == NAMESPACE_DECL)
push_decl_namespace (t);
! else
pushclass (t, 2);
}
/* Leave scope pushed by push_scope. */
--- 4032,4042 ----
push_scope (t)
tree t;
{
if (TREE_CODE (t) == NAMESPACE_DECL)
push_decl_namespace (t);
! else if (CLASS_TYPE_P (t))
pushclass (t, 2);
}
/* Leave scope pushed by push_scope. */
*************** void
*** 4044,4054 ****
pop_scope (t)
tree t;
{
if (TREE_CODE (t) == NAMESPACE_DECL)
pop_decl_namespace ();
! else
popclass ();
}
/* [basic.lookup.koenig] */
/* A nonzero return value in the functions below indicates an error. */
--- 4044,4054 ----
pop_scope (t)
tree t;
{
if (TREE_CODE (t) == NAMESPACE_DECL)
pop_decl_namespace ();
! else if (CLASS_TYPE_P (t))
popclass ();
}
/* [basic.lookup.koenig] */
/* A nonzero return value in the functions below indicates an error. */
Index: testsuite/g++.dg/template/op1.C
===================================================================
RCS file: testsuite/g++.dg/template/op1.C
diff -N testsuite/g++.dg/template/op1.C
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- testsuite/g++.dg/template/op1.C 21 Feb 2003 21:43:28 -0000
***************
*** 0 ****
--- 1,12 ----
+ template <class T> struct X {
+ typedef int type;
+ };
+
+ template <class T> struct O {
+ struct I {
+ operator typename X<T>::type ();
+ };
+ };
+
+ template <class T>
+ O<T>::I::operator typename X<T>::type () {}