2014-02-28 22:52 GMT+01:00 Fabien Chêne <fabien.ch...@gmail.com>: > 2014-02-28 22:27 GMT+01:00 Jason Merrill <ja...@redhat.com>: >> Let's change the C++11 diagnostic to match the C++98 diagnostic. So, >> "uninitialized const member in %q#T" + "%qD should be initialized". > > OK.
Hmm, sorry to iterate on this rather trivial issue, but it seems difficult to mimic the c++98 diagnostic. Actually, the c++98 diagnosic raises an error at the point of use, mention the class implied, and add a note at the ref/const member uninitialized. Doing that in c++11 is not currently possible because input_location is sabotaged early in maybe_explain_implicit_delete (unless there is some magic incantation in the diagnostic machinery I am not aware of), and the point of use is lost. Reading the comment of synthesized_method_walk, which is the only caller of walk_field_subobs: "If diag is true, we're either being called from maybe_explain_implicit_delete to give errors, or if constexpr_p is non-null, from explain_invalid_constexpr_fn." I am inclined to think that if we reached one the two functions mentioned, an error had already been raised and we are trying to explain why. Thus, it seems to me that only notes should be emitted. Here we are actually explaining why the default constructor is deleted, which is a kind of subnote. Hence, I would say that emitting an error at this point would be seen as a different issue by the user. All in all, in my opinion, just emitting a note would be appropriate given the context. If agreed, the comment above should be adjusted, and says "... called from maybe_explain_implicit_delete to ***emit additional notes***...", and the errors raised in callees shall be turned into notes. Unfortunalely, the comment does not match the code and synthesized_method_walk is called with diag=true in another context: /* Warn about calling a non-trivial move assignment in a virtual base. */ if (kind == sfk_move_assignment && !deleted_p && !trivial_p && CLASSTYPE_VBASECLASSES (type)) { location_t loc = input_location; input_location = DECL_SOURCE_LOCATION (fn); synthesized_method_walk (type, kind, const_p, NULL, NULL, NULL, NULL, true, NULL_TREE, NULL_TREE); input_location = loc; } ... Which breaks the logic above, even if it probably intends to reach this warning later: warning (OPT_Wvirtual_move_assign, "defaulted move assignment for %qT calls a non-trivial " "move assignment operator for virtual base %qT", ctype, basetype); This can of revamping I suggest can wait for next stage 1, obviously... What do you think ? -- Fabien