https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68711
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2015-12-05 CC| |jason at redhat dot com Ever confirmed|0 |1 Known to fail| |6.0 --- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> --- I suspect this is caused by the merge of the C++ delayed folding branch in r230365 (CC'ing Jason). The problem is in the function build_class_member_access_expr(). The following otherwise untested change restores the expected diagnostic: --- gcc/cp/typeck.c (revision 231314) +++ gcc/cp/typeck.c (working copy) @@ -2358,8 +2358,14 @@ int type_quals; tree member_type; - null_object_p = (INDIRECT_REF_P (object) - && integer_zerop (TREE_OPERAND (object, 0))); + if (INDIRECT_REF_P (object)) + { + tree oper = TREE_OPERAND (object, 0); + STRIP_NOPS (oper); + null_object_p = integer_zerop (oper); + } + else + null_object_p = false; /* Convert OBJECT to the type of MEMBER. */ if (!same_type_p (TYPE_MAIN_VARIANT (object_type),