http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39415
James Dennett <james.dennett at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |james.dennett at gmail dot | |com --- Comment #5 from James Dennett <james.dennett at gmail dot com> 2010-11-12 04:10:16 UTC --- Jason Merrill <ja...@redhat.com> has given me a heavy hint leading to the following smaller and much less ugly patch for cp/typeck.c that makes it more symmetrical with the reference case. This also passes my simple tests. .../gcc/cp $ svn diff Index: typeck.c =================================================================== --- typeck.c (revision 164712) +++ typeck.c (working copy) @@ -5999,7 +5999,8 @@ 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); + expr = build_base_path (MINUS_EXPR, expr, base, /*nonnull=*/false); + return cp_fold_convert(type, expr); } if ((TYPE_PTRMEM_P (type) && TYPE_PTRMEM_P (intype))