diff options
author | Gabriel Dos Reis <gdr@nerim.net> | 2002-08-05 03:56:16 +0000 |
---|---|---|
committer | Gabriel Dos Reis <gdr@gcc.gnu.org> | 2002-08-05 03:56:16 +0000 |
commit | 201fbb7f201cd7af4491ce07a7c5b4aa7ee99e22 (patch) | |
tree | 0396b79f9721a797ae44442b4ecfa5e6bb85b53d /gcc/cp/cvt.c | |
parent | b58bbfbb9bf3fa1a21e56b707aeca8ab4ac7a340 (diff) | |
download | gcc-201fbb7f201cd7af4491ce07a7c5b4aa7ee99e22.zip gcc-201fbb7f201cd7af4491ce07a7c5b4aa7ee99e22.tar.gz gcc-201fbb7f201cd7af4491ce07a7c5b4aa7ee99e22.tar.bz2 |
Fix PR/2213
cp/
Fix PR/2213
* cvt.c (cp_convert_to_pointer): Reject conversions from integral
expressions to pointer-to-data-member of pointer-to-member-functions.
testsuite/
* g++.dg/other/conversion1.C: New test.
From-SVN: r56039
Diffstat (limited to 'gcc/cp/cvt.c')
-rw-r--r-- | gcc/cp/cvt.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c index fd4b6b9..26af72f 100644 --- a/gcc/cp/cvt.c +++ b/gcc/cp/cvt.c @@ -256,6 +256,12 @@ cp_convert_to_pointer (type, expr, force) force_fit_type (expr, 0); return expr; } + else if ((TYPE_PTRMEM_P (type) || TYPE_PTRMEMFUNC_P (type)) + && INTEGRAL_CODE_P (form)) + { + error ("invalid conversion from '%T' to '%T'", intype, type); + return error_mark_node; + } if (INTEGRAL_CODE_P (form)) { |