Commit 201fbb7f by Gabriel Dos Reis Committed by Gabriel Dos Reis

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
parent b58bbfbb
2002-08-04 Gabriel Dos Reis <gdr@nerim.net>
Fix PR/2213
* cvt.c (cp_convert_to_pointer): Reject conversions from integral
expressions to pointer-to-data-member of pointer-to-member-functions.
2002-08-04 Geoffrey Keating <geoffk@redhat.com>
* cvt.c (ocp_convert): Delete obsolete code.
......
......@@ -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))
{
......
2002-08-04 Gabriel Dos Reis <gdr@nerim.net>
* g++.dg/other/conversion1.C: New test.
2002-08-03 Roger Sayle <roger@eyesopen.com>
* gcc.dg/builtins-1.c: New testcase.
......
// PR C++/2213
// Origin: philippeb@corel.com
// Copyright (C), 2002 Free Software Foundation
// Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net>
// { dg-do compile }
class QObject
{
};
int main()
{
long long m;
(void (QObject::*)()) m; // { dg-error "invalid conversion" "" }
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment