[Bug c++/44916] Incorrect function overloading with static_cast
james dot dennett at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sun Jul 18 21:38:00 GMT 2010
------- Comment #1 from james dot dennett at gmail dot com 2010-07-18 21:37 -------
Thanks to Ian for reporting this for me (my buganizer account wasn't well at
the time).
This appears to duplicate bug 39415.
I have a hacky fix for this, adding a conversion to the correct target type
after the conversion used by the current code, included here for reference:
$ svn diff gcc/cp/typeck.c
Index: gcc/cp/typeck.c
===================================================================
--- gcc/cp/typeck.c (revision 157950)
+++ gcc/cp/typeck.c (working copy)
@@ -5743,7 +5743,14 @@
base = lookup_base (TREE_TYPE (type), TREE_TYPE (intype),
c_cast_p ? ba_unique : ba_check,
NULL);
- return build_base_path (MINUS_EXPR, expr, base, /*nonnull=*/false);
+ return build_static_cast_1 (type,
+ build_base_path (MINUS_EXPR,
+ expr,
+ base,
+ /*nonnull=*/false),
+ c_cast_p,
+ valid_p,
+ complain);
}
if ((TYPE_PTRMEM_P (type) && TYPE_PTRMEM_P (intype))
--
james dot dennett at gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |james dot dennett at gmail
| |dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44916
More information about the Gcc-bugs
mailing list