[PATCH] D158540: Improve error message for constexpr constructors of virtual base classes

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 11 13:01:24 PDT 2023


aaron.ballman added a comment.

In D158540#4638605 <https://reviews.llvm.org/D158540#4638605>, @NoumanAmir657 wrote:

> In D158540#4632457 <https://reviews.llvm.org/D158540#4632457>, @NoumanAmir657 wrote:
>
>> @aaron.ballman 
>> This error gets generated on test cases even when a struct/class as no virtual base class.
>> see this example on here: example <https://godbolt.org/z/47sYGjWxP>
>>
>> Is this right behaviour? The note for this should not be generated since this does not have a virtual base class.
>>
>> The example above is from a test case file in clang. The error message is the one which was supposed to be improved for this patch.
>>
>> Can you clarify this
>
> @aaron.ballman waiting for your clarification on this to make the changes

Sorry about the delayed response -- the issue is that you've modified the diagnostic wording but not the logic for when we emit the diagnostic. I think you will need to end up modifying `defaultedSpecialMemberIsConstexpr()` to return information about *why* the member is not constexpr so that you can select between various diagnostic messages. e.g., you're implementing this FIXME: https://github.com/llvm/llvm-project/blob/c154ba8abeb6f59f85a9bb6fdf7bd79ad0d8c05c/clang/lib/Sema/SemaDeclCXX.cpp#L7817 This may also require you to add more diagnostics/`%select` uses because there are multiple reasons it could have failed. Does that make sense?


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

https://reviews.llvm.org/D158540



More information about the cfe-commits mailing list