[PATCH] D146358: [clang][AST] Print name instead of type when diagnosing uninitialized subobject in constexpr variables

Christopher Di Bella via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 28 17:48:45 PDT 2023


cjdb added a comment.

In D146358#4229120 <https://reviews.llvm.org/D146358#4229120>, @hazohelet wrote:

> In D146358#4227938 <https://reviews.llvm.org/D146358#4227938>, @cjdb wrote:
>
>> In D146358#4204412 <https://reviews.llvm.org/D146358#4204412>, @tbaeder wrote:
>>
>>> "subobject named 'foo'" sounds a bit weird to me, I'd expect just "subobject 'foo'", but that's just a suggestion and I'll wait for a native spearker to chime in on this.
>>
>> My expert brain likes `subobject of type 'T'`, but it's very wordy, and potentially not useful additional info. I'm partial to `subobject 'T'` due to it being the thing we're more likely to say in conversation (e.g. "that `int` isn't initialised"). I've also put out a mini-survey on the #include <C++> Discord server, and will update in a few hours.
>
> Hi, @cjdb thanks for your feedback and the mini-survey.
> The objective of this patch is to print the subobject's name instead of its type when it is not initialized in constexpr variable initializations. Thus, I think it would be appropriate to add some more options to the survey like "subobject named 'foo' is not initialized" and "subobject 'foo' is not initialized" when the code looks like the following:
>
>   template <typename T>
>   struct F {
>   	T foo;
>   	constexpr F(){}
>   };
>   constexpr F <int>f;

Ah, in that case, `subobject 'foo'` is better than `subobject named 'foo'` to me.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146358/new/

https://reviews.llvm.org/D146358



More information about the cfe-commits mailing list