[C++ PATCH] Fix PR/11097
Giovanni Bajo
giovannibajo@libero.it
Sun Jun 15 15:28:00 GMT 2003
Hello,
the following patch fixes PR/11097. tsubst_decl was not substituting the
parameters within the DECL_NAME of a USING_DECL. This is necessary because
it might be a dependent name. This patch also fixes the error message of
error5.C (which I have sent yesterday) to correctly display S<int>::I
instead of S<T>::I.
Bootstrapped on i686-pc-cygwin with all languages, tested with a top-level
"make -k check" with no new regressions (and without testing libstdc++
testsuite).
OK for mainline?
Giovanni Bajo
2003-06-15 Giovanni Bajo <giovannibajo@libero.it>
PR c++/11097
* pt.c (tsubst_decl): substitute also the DECL_NAME node of
USING_DECL.
2003-06-15 Giovanni Bajo <giovannibajo@libero.it>
PR c++/11097
* g++.dg/other/error5.C: modified the error message
* g++.dg/lookup/using7.C: new test
Index: pt.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/cp/pt.c,v
retrieving revision 1.697
diff -c -w -r1.697 pt.c
*** pt.c 3 Jun 2003 13:01:43 -0000 1.697
--- pt.c 15 Jun 2003 14:42:38 -0000
***************
*** 6260,6265 ****
--- 6260,6267 ----
r = copy_node (t);
DECL_INITIAL (r)
= tsubst_copy (DECL_INITIAL (t), args, complain, in_decl);
+ DECL_NAME (r)
+ = tsubst_copy (DECL_NAME (t), args, complain, in_decl);
TREE_CHAIN (r) = NULL_TREE;
}
break;
*** error5old.C Sun Jun 15 16:53:13 2003
--- error5.C Sun Jun 15 16:53:32 2003
***************
*** 7,13 ****
};
template <typename T> struct S2 : S<T> {
! using S<T>::operator typename S<T>::I*; // { dg-error "operator
S\\<T\\>" "" }
};
template struct S2<int>; // { dg-error "instantiated" "" }
--- 7,13 ----
};
template <typename T> struct S2 : S<T> {
! using S<T>::operator typename S<T>::I*; // { dg-error "operator
S\\<int\\>" "" }
};
template struct S2<int>; // { dg-error "instantiated" "" }
// { dg-do compile }
// Origin: Bill Clarke <llib at computer dot org>
// PR c++/11097: using declartion for a converter operator to a nested class
// in a base type
template <typename T>
struct A
{
struct Nested {};
operator Nested*();
};
template <typename T>
struct B : A<T>
{
using A<T>::operator typename A<T>::Nested*;
};
template struct B<int>;
More information about the Gcc-patches
mailing list