hazohelet added a comment.

In D146358#4268327 <https://reviews.llvm.org/D146358#4268327>, @tbaeder wrote:

> So, if I understand the code correctly, we call `CheckEvaluationResult` with 
> `SubObjectDecl=nullptr` when we're not checking an actual field but just an 
> array/record, so we can't run into this problem anyway, so the assert seems 
> fine.
>
> I don't fully understand the problem with the `gnu::weak` stuff, in any case, 
> adding it to  this patch seems wrong. https://godbolt.org/z/qn997n85n 
> //does// emit a note, but it's not the one this patch is about, so is that 
> even relevant?

Thanks. I opened another differential for the `gnu::weak` stuff (D148419 
<https://reviews.llvm.org/D148419>).
If my understanding is correct, `Info.FFDiag` displays only the note of its 
first call and discard the notes after it. So, the uninitialized-note is not 
displayed.
You can confirm this by deleting only the FFDiag call 
(https://github.com/llvm/llvm-project/blob/6f7e5c0f1ac6cc3349a2e1479ac4208465b272c6/clang/lib/AST/ExprConstant.cpp#L13143-L13144)
 from the clang trunk and compile my godbolt code to see the note (`note: 
subobject of type 'const bool' is not initialized`)
Although the `return true` says the `[[gnu::weak]]` member pointer comparison 
is valid, constexpr engine considers the constant initialization has failed if 
there is note emitted during the initializer 
evaluation(https://github.com/llvm/llvm-project/blob/6f7e5c0f1ac6cc3349a2e1479ac4208465b272c6/clang/lib/AST/Decl.cpp#L2591-L2592)
 and it's why `[[gnu::weak]]` comparison note is actually emitted in spite of 
the wrong signal about the validness of the expression.


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

https://reviews.llvm.org/D146358

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to