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

    <tr>
        <th>Summary</th>
        <td>
            Accessing qualified member of a structure or union rvalue allows creating qualified rvalues
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    The following code demonstrates the issue:
```c
struct{
    const int c;
}foo();
puts(_Generic(foo().c,int:"A",const int:"B"));
```
`foo` returns a structure that contains a qualified member named `c` of type `const int`. Calling `foo` results in an rvalue structure, which when accessing one of the members via `.` results in an rvalue. Clang does not remove qualifiers or _Atomic (C23 removes _Atomic from rvalues as well) here while GCC does and the result of DR 423 seems intended to remove cases of qualified rvalues. Additionally, Clang actually generates a warning here with the default warnings stating that the `const int` branch will never be taken (and then it takes it anyway). The wording doesn't  state that the result is the non-atomic (C23) and unqualified member when getting the member though I assume that is a defect.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0VMGO6zYM_BrlQqzhyLGdHHzIZpHXXoveHxiJttXK0laiEuTvC9le77aLhySIRVOc4WhEjNEMjqgT9auo33aYePSh-w1t_qQn9mhstbt5_ez-HAl6b61_GDeA8ppA0-Rd5IBMEXgkMDEmEtVZlG-iPIumXL5qWUcOSbFoX5clAIDK-8E4BiWqNS7at957IY9Cnrbge-Io5PHnD3IUjBLyuOUUSsiLcZxxpcw_IS9b4SX6OkdPXytu7LZlrtiUEIhTcBEQFsIpEPCInMkymvnNPwmt6Q1pmGi6UQCHE2mYe21K8D3w853m9UakKQu4oLVZvq9oMVmOYBygg3BHm-gTWMgLPEajRniM5ACVohhzAe9oRhlpZRDhbjDXLX5VtYCLRTeA9hTBeYZAk7_T1kuI4AP8PLOfjAIhjxdZrTlxC_fBT2u9CBjhQdYKeYKRAmWmluDH5bJgoNMzwYVMpvv2BxxkBZFoytyYnCYN7D-oKIwUc-KnvitWAWetDRvv0NpnlmVpBhWnHIEhG2M2IsIDg8siLaQMjzMNTT1mHuvbCJGRc9p8uDnjf8cFt4AuS2-sBUd3CnAjYPybXJZnbc-B4TkY8wO65wOf2ZWQL8zDB21WzZ2QLcOMSp-YqzhmuUDOuxf8egBZ2wyU3DfLzY4YiNcePowAPPo0jPA7YIxpWqFM1kVTT4qLne4qfapOuKNu3-5PVd22TbUbu72um6Y6HmVdneTxsG_a2_6I2JZVTVWv653pZCkPZSNrWUl52BeyqY9Nq8u6PSi9L_fiUNKExhbW3qfCh2E3j4Tu1LT7amfxRjbOw0ZKR491XkiZZ0_o8p6XWxqiOJTWRI6fVdiwpe682f-bGL7_z331AZIzfrtQmOdWBBVoOfJv_tqlYLuR-T3OA-Mq5HUwPKZbofwk5DUzWf9e3oP_ixQLeZ35RyGvS3_3Tv4bAAD__0hWxDc">