<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/92382>92382</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Clang] Comparison between pointers to a string literal and some other object results in constant evaluation failure
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
frederick-vs-ja
</td>
</tr>
</table>
<pre>
The following code snippet is incorrectly rejected by Clang ([Godbolt link](https://godbolt.org/z/sYcjG6aTP)).
```C++
static_assert([]{
char arr[1]{};
return arr != "a";
}());
```
`arr` is not a potentially non-unique object, so it must have a different address from that of string literal object `"a"`, even though the latte is a potentially non-unique object. As a result, `arr != "a"` has a specified result (`true`), so the static assertion should be accepted.
#49380 is related. But that issue involved comparison between pointers to different string literal objects, where it's very non-trivial to determine whether the result is unspecified.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyElEGvozYQxz-NuYwSgYEEDhxeEmWvPeylp2rAk-C3xqb2mKfXT18Z2N02qrqSlSDP2P7P7-8xhqCflqgT9UXUtwwjj853D0-KvB6-HZZweMesd-qz-zoSPJwx7kPbJwxOEQSr55kYdABtB-c9DWw-wdM7DUwK-k-4GrRPELIR9eWLU70zDEbbb6K-CdmMzHMQ5ZuQdyHvzy1-dP4p5P0vIe_h9-H9ywm__iZkK2R7FPlN5G_77ynfxlXISxrrbGBkPfyBIZDn7dh01HkPwzCiB_Re1JdiD5xvovweBgBPHL1NOSBkIcobCClRSPkjK62QzSbp5-R3OS8a01mnPCGyjgFhdkyWNRrzCdbZQ7T6z0jg-sRMyCsEB5phioFhxIUAQenHgzxZBlTKUwjw8G4CHpHBPSCwT44YzeTR7DtBUrLrTl9XoIUs8OjicwQeCQwyU9L1C01HeEs5nkI0q8CtqFc4pxxGTIlhpkE_NKl9yWr-KWcfaVXS7kUmDZtbsLmlnYUwumgU9AQ4DDQzqX97LsuqLZsVpyeDKQ6XyBsLHUIk0HZxZiEFg5tm9Do4Cz3xB5GF2WnL5AOw-wfV_wQYksyPkTyBZiHPARbyGx72etFo1k2IyU_aUkrlkfxa1l64DhDtDxzHTHWlassWM-qKc1E3dVNVZTZ2mGNTkhpk1dQFNapUZVH3uZJVJSuUmOlO5rLK6-JUFDIv26NCLKqGTqrE5twXrahymlCbozHLlPonW1l0rSwbmRnsyYS1x6UcUkMmw-pb5ruUf-jjM4gqNzpw-LkDazbrw7C2sKhvcP1_oPgKEq2C4CYCt5LZL-YGJ70YMDgbGC0DLWgirjfggdpET1n0pnt5HjSPsT8ObhLynmTuf4fZu6157mvVQcj7WvjfAQAA___XzpIG">