[clang] [clang] implement current direction of CWG2765 for string literal comparisons in constant evaluation (PR #109208)

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 19 14:30:27 PDT 2024


zygoloid wrote:

> I'm happy once SOME level of solution for the index-starting-value is done (`NextStringLiteralVersion=rand()` 🤡). I think the avoided collisions is worth a touch of effort, but not much more.

Um. So. I added a test for this before I started working on a fix, and ... the test passes. It turns out that the existing implementation already works: while we do have some support for importing computed constant values, we always recompute constants locally before using them as inputs to further local constant evaluations, so we produce a local numbering even for what appear to be imported constants.

We would need to do something different here if we ever change that, but we now have test coverage for it, so we should notice.

> I think there is some concern from others about `opaque` that should probably be settled on, but I'm happy with whatever all of you come up with, even if it is `opaque`.

I hope I've addressed that by including the value of the pointer in the diagnostic.

https://github.com/llvm/llvm-project/pull/109208


More information about the cfe-commits mailing list