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

    <tr>
        <th>Summary</th>
        <td>
            Poor diagnostic wording for mixing signed/unsigned with typedef types
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            enhancement,
            clang:diagnostics
      </td>
    </tr>

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

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

<pre>
    Consider the following code (in either C or C++):
```
typedef int foo_t;

unsigned foo_t not_the_best;
foo_t unsigned even_worse;
```
We currently give two different diagnostics for this, neither of which are very good at explaining what's gone wrong.
```
<source>:3:10: error: redefinition of 'foo_t' as different kind of symbol
unsigned foo_t not_the_best;
 ^
<source>:1:13: note: previous definition is here
typedef int foo_t;
            ^
<source>:3:15: error: expected ';' after top level declarator
unsigned foo_t not_the_best;
              ^
 ;
<source>:4:7: error: 'type-name' cannot be signed or unsigned
foo_t unsigned even_worse;
      ^
3 errors generated.
```
The first diagnostic happens because we've decided this is the declaration of a variable named `foo_t`, and the second diagnostic appears to just be poor wording rather than poor behavior.

Ideally, these would produce the same diagnostic and would not use grammar terms like `type-name`. e.g., `cannot combine %select{'signed'|'unsigned'}0 with a typedef type` or something along those lines.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVUFvqzgX_TVmc1XkmgDJgkWavkjf7luMNMvK4Av4PeOLbJM0_350Sdomo47mTUVjgo3POfec6-gY7eARG1G-iPI100saKTR7Hci_aOcm7bOWzKU5kI_WYIA0IvTkHJ2tH6AjgyDU1npAm0YMcAAKcBDqZb12otgL-SrkXlTydq1f02VGgz1Yn6AnekuieLktXD8XvxIz10nwlN7SiG8txq-V16nPlXhC_3amEPFrr0fQPxG6JQT0yV1gsCeEdCYwtu-RH4KxevAUk-0i9MRabRTqAP6mjXo4j7YbQQeEE4YLDEQGdAJ8n522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