<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/96458>96458</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            -Wdangling false positive on string literal
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang:frontend
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          hokein
      </td>
    </tr>
</table>

<pre>
    Clang emits a warning on the following code:

```
void test() {
 const char* bad  = (char []){"abc"}; // bad: -Wdangling warning.
 const char* good = (const char*){"abc"}; // good, no warning.
}
```

According to the standard `Evaluating a string-literal results in a string literal object with static storage duration`, it is safe to have a pointer that points to the string literal.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8ksuOozwQhZ_GbEqJoAi3BYt0588r_OvCroBnHDuyC1rz9iMnfcmMWiMhI_tQdT5Th1Kys2ceVfOimlNBqywhjkv4ydYXUzC_xldHfga-WklA8EbRWz9D8CALwyU4F97ygQ6GVX1U5UmVH2tbvj_37RasAeEkCnuFA6ju5SGADj4J6IWiwiNMZABUfQKFfT6DB5vCIVcg0qQVoupOqn4BhWeF51yj6iPs_jfkZ5d53kH331rMIZhPi2flnya5SuEr-PBX9_zZdzd-rEetQzSZScL9pyUhbygaUG3530ZuJckqQZJo_bxzVjiSg8hpdZLA-k8NPrQw_WAt8GZlyf3EakgSIs0MZo0kNviMga9gBWyCRBfO_gttDAS3YL1wBFlIHpv0RfdstC_MWJuhHqjgseqqAatmKNtiGZth6HpdaWrribq6RbyYymgudUODbqfCjljioWzxUHZNj-2-1zh0Q48Tm4q56tSh5CtZt3duu-5DnAub0srj0B6avnA0sUv3YCLqHEJVHy8xeGFv8myaUxHHXLqb1jmpQ-lskvTVTKw4Hp8icSGXGG4hWbEb5wj_eddijW5cRG4pB_k-89nKsk57Ha4Kz7nz-2t3iyEPQOH5zpwUnh_Y24i_AwAA__8GtAtP">