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

    <tr>
        <th>Summary</th>
        <td>
            Undefined internal function warning with generic selection expressions
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            c11,
            clang:frontend,
            rejects-valid
      </td>
    </tr>

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

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

<pre>
    C23 6.9p3 says:

There shall be no more than one external definition for each identifier declared with internal linkage
in a translation unit. Moreover, if an identifier declared with internal linkage is used in an expression
there shall be exactly one external definition for the identifier in the translation unit, unless it is:
— part of the operand of a sizeof operator whose result is an integer constant;
— part of the operand of an alignof operator whose result is an integer constant;
— part of the controlling expression of a generic selection;
— part of the expression in a generic association that is not the result expression of its generic
selection;
— or, part of the operand of any typeof operator whose result is not a variably modified type.

Clang incorrectly handles the generic association bullet. Consider:
```
static void *a(void);
_Generic(0, int : 0, default: a);
```
Clang diagnoses the mention of `a` despite that being in an association that is not the result expression. This rejects valid code under `-pedantic-errors`.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVE2P4zYP_jXyhRhDkRMnOfgwH--8p96254KWaJutQgWSnJn01xeWs7vZbTvdAgWCRFLw8PkQRUyJRyHq1O5J7V4qnPMUYveIMcgTen9Cqfrgrt2zaaCtj-cGEl6Tah6VflH69v1pokiQJvQeegIJcAqRIE8oEISA3jNFQQ-OBhbOHASGEIHQTsCOJPPAFMGR9RjJwRvnCVhuKM_yG460crEAQo4oyWMpNAvnGn4KkcKFojLPwAOg_Hhd4ARzIgdLaQF6P0dKiYOshPlbc_SONvvrh77yRPf0LOXke9GL1Fk8pQScge9C_Z9RB62OWzhjzBCGAg9niihu2SIk_p3CsJ7lEOFtCokgUpr9Uqr4l0wjRbBBUkbJqnn60fIC6HmU_5bABskxeM8y3mW82hlJKLKFRJ7sEtA_1LrDl374jMeUguU14jxhUSohF8xN-7fUnNNn8Mr3kYJQuutvQ7tCvp4_vJVFCsIFI2Pvr3AKbmkQV3D1_YN69igjsNgQI5V2m1Ccp1RY_8ptP3tPuYbnIIkdxa_N1OrbZ_WXMbOFS2AHyjyiModlrczxi-Ff_n8LxBx0eU6SQTWPUDaOBpx9XvZ4D_qOZjXgGEcJ6Sb7tDyINXbValStBkfpzJnWu-qJi-nSf__mImv4NHGCSL-SzQku6NmBDY5gFkdxYXs4k0PJbB8oxhCTanVdua5xx-aIFXWbvdH7zW6v99XU9W177A_NfntEjXs07b7Z4kHbxm22TltdcWe02er9ZrNpm51u6q227bDrN9Q4S7axaqvphOxr7y-nOsSx4pRm6o6Hnd5WHnvyqYxcY-xmo4xR5nlZL6mp5nGIQTKJ-_LHzdpDsbac7l6q2C3FH_p5TGqrPaecvtJlzp66n6UMpjLabpNqmKW0N7xhlCXvMhL_9P7u0k3VHH035XwuE8q8KvM6cp7mvrbhpMzrQnr7eTjHsChV5rUYTsq8rp4vnfkjAAD___WNKGc">