https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86922
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |diagnostic, wrong-code --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- It warns about dereferencing (int (*) () * *) &((const struct B *) obj)->D.2305 which is built via #2 0x0000000000b585af in cp_build_indirect_ref_1 ( ptr=<nop_expr 0x7ffff6a06220>, errorstring=RO_NULL, complain=3, do_fold=true) at /tmp/trunk/gcc/cp/typeck.c:3155 #3 0x0000000000b58938 in cp_build_fold_indirect_ref ( pointer=<nop_expr 0x7ffff6a06220>) at /tmp/trunk/gcc/cp/typeck.c:3232 #4 0x0000000000b59a5e in get_member_function_from_ptrfunc ( instance_ptrptr=0x7fffffffc868, function=<ptrmem_cst 0x7ffff69f0600>, complain=3) at /tmp/trunk/gcc/cp/typeck.c:3565 #5 0x000000000097aabd in build_offset_ref_call_from_tree ( fn=<ptrmem_cst 0x7ffff69f0600>, args=0x7fffffffc958, complain=3) at /tmp/trunk/gcc/cp/decl2.c:5095 #6 0x0000000000ab9d26 in tsubst_copy_and_build (t=<call_expr 0x7ffff69f61b0>, args=<tree_vec 0x7ffff69f07a0>, complain=3, in_decl=<template_decl 0x7ffff68b6580 operator()>, function_p=false, integral_constant_expression_p=false) at /tmp/trunk/gcc/cp/pt.c:18485 the fnptr type has an alias-set that isn't compatible with that of struct B. Not sure where that int return type comes from ... Fishy. And possibly wrong-code afterwards because of that alias set.