[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 11:49:33 PDT 2024


================
@@ -96,6 +96,8 @@ def note_constexpr_pointer_constant_comparison : Note<
   "at runtime">;
 def note_constexpr_literal_comparison : Note<
   "comparison of addresses of literals has unspecified value">;
+def note_constexpr_opaque_call_comparison : Note<
+  "comparison against opaque constant has unspecified value">;
----------------
zygoloid wrote:

It's not necessarily anonymous, or an object. For example, we get one of these constants from `__builtin_start_address(function)`, where the returned address is often the address of the function (though in some cases it might be a different code address -- and we don't know).

Added the actual pointer value to the diagnostic:
```
note: comparison against opaque constant address '&__builtin_function_start(a)' has unspecified value
```
Hopefully that makes it a bit clearer what the problem is :)

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


More information about the cfe-commits mailing list