https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65323
Kai Tietz <ktietz at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ktietz at gcc dot gnu.org --- Comment #3 from Kai Tietz <ktietz at gcc dot gnu.org> --- Hmm, the issue seems to be that we emit within check_default_argument () two times the call to maybe_warn_zero_as_null_pointer_constant (). Once indirectly via perform_implicit_conversion_flags () call, and then later on directly within if-condition for returning nullptr_node. It seems that second call is superflous in terms of warning. So I suggest the following patch: Index: decl.c =================================================================== --- decl.c (Revision 221277) +++ decl.c (Arbeitskopie) @@ -11231,7 +11233,8 @@ check_default_argument (tree decl, tree arg, tsub && TYPE_PTR_OR_PTRMEM_P (decl_type) && null_ptr_cst_p (arg) && (complain & tf_warning) - && maybe_warn_zero_as_null_pointer_constant (arg, input_location)) + && c_inhibit_evaluation_warnings == 0 + && !NULLPTR_TYPE_P(TREE_TYPE (arg))) return nullptr_node; /* [dcl.fct.default]