aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/pt.c
diff options
context:
space:
mode:
authorGiovanni Bajo <giovannibajo@libero.it>2003-11-14 05:51:21 +0100
committerBernardo Innocenti <bernie@gcc.gnu.org>2003-11-14 05:51:21 +0100
commit28e8f3a00ee4012f8642a68c9b4f4845436b77a4 (patch)
tree9d20aac67ecb6453b7de3ccbfa5ec78667ee58df /gcc/cp/pt.c
parent0f8db53eaf3c743fd891c6a53c2020713d90d53c (diff)
downloadgcc-28e8f3a00ee4012f8642a68c9b4f4845436b77a4.zip
gcc-28e8f3a00ee4012f8642a68c9b4f4845436b77a4.tar.gz
gcc-28e8f3a00ee4012f8642a68c9b4f4845436b77a4.tar.bz2
re PR c++/2094 (unimplemented: use of `ptrmem_cst' in template type unification)
PR c++/2094 * pt.c (unify): Add support for PTRMEM_CST and FIELD_DECL unification. From-SVN: r73577
Diffstat (limited to 'gcc/cp/pt.c')
-rw-r--r--gcc/cp/pt.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index cd93423..4afe974 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -9617,6 +9617,27 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict)
TREE_VEC_ELT (targs, idx) = arg;
return 0;
+ case PTRMEM_CST:
+ {
+ /* A pointer-to-member constant can be unified only with
+ another constant. */
+ if (TREE_CODE (arg) != PTRMEM_CST)
+ return 1;
+
+ /* Just unify the class member. It would be useless (and possibly
+ wrong, depending on the strict flags) to unify also
+ PTRMEM_CST_CLASS, because we want to be sure that both parm and
+ arg refer to the same variable, even if through different
+ classes. For instance:
+
+ struct A { int x; };
+ struct B : A { };
+
+ Unification of &A::x and &B::x must succeed. */
+ return unify (tparms, targs, PTRMEM_CST_MEMBER (parm),
+ PTRMEM_CST_MEMBER (arg), strict);
+ }
+
case POINTER_TYPE:
{
if (TREE_CODE (arg) != POINTER_TYPE)
@@ -9805,6 +9826,7 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict)
return 1;
return 0;
+ case FIELD_DECL:
case TEMPLATE_DECL:
/* Matched cases are handled by the ARG == PARM test above. */
return 1;