aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/pt.c
diff options
context:
space:
mode:
authorDodji Seketeli <dodji@gcc.gnu.org>2009-04-23 13:15:33 +0200
committerDodji Seketeli <dodji@gcc.gnu.org>2009-04-23 13:15:33 +0200
commit111a28c29e1f0af6064dd1a3ba2f9eac09ad00eb (patch)
tree9cf794ed9aa81713d4ecea5e289646e8597a6fcf /gcc/cp/pt.c
parentc1abd261d91caa67f71439292081b7299d4f5788 (diff)
downloadgcc-111a28c29e1f0af6064dd1a3ba2f9eac09ad00eb.zip
gcc-111a28c29e1f0af6064dd1a3ba2f9eac09ad00eb.tar.gz
gcc-111a28c29e1f0af6064dd1a3ba2f9eac09ad00eb.tar.bz2
re PR c++/38228 (ICE with invalid use of bound member function)
gcc/cp/ChangeLog: PR c++/38228 * pt.c (unify): Do not allow the result of a template argument deduction to be a METHOD_TYPE. * cvt.c (cp_convert): Report a meaningful error for non-valid use of pointer to member functions during conversions. * call.c (build_new_op): Report a meaningful error for non-valid use of pointer to member functions in binary expressions. * typeck.c (invalid_nonstatic_memfn_p): Do not crash when EXPR is NULL; gcc/testsuite/ChangeLog: PR c++/38228 * g++.dg/expr/bound-mem-fun.C: New test. From-SVN: r146646
Diffstat (limited to 'gcc/cp/pt.c')
-rw-r--r--gcc/cp/pt.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index a4a5c10..4844333 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -13581,6 +13581,13 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict)
&& !template_parameter_pack_p (parm))
return 1;
+ /* If the argument deduction results is a METHOD_TYPE,
+ then there is a problem.
+ METHOD_TYPE doesn't map to any real C++ type the result of
+ the deduction can not be of that type. */
+ if (TREE_CODE (arg) == METHOD_TYPE)
+ return 1;
+
TREE_VEC_ELT (INNERMOST_TEMPLATE_ARGS (targs), idx) = arg;
return 0;