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

    <tr>
        <th>Summary</th>
        <td>
            [Clang] Duplicate diagnostics in C++20+ mode: incomplete type in nested name specifier
        </td>
    </tr>

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

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

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

<pre>
    Clang emits duplicate diagnostics when compiling the following code in C++20+ mode:

```cpp
struct incomplete;
incomplete::type var;
```

Output:

```txt
<source>:2:1: error: incomplete type 'incomplete' named in nested name specifier
    2 | incomplete::type var;
      | ^~~~~~~~~~~~
<source>:1:8: note: forward declaration of 'incomplete'
    1 | struct incomplete;
      |        ^
<source>:2:1: error: incomplete type 'incomplete' named in nested name specifier
    2 | incomplete::type var;
      | ^~~~~~~~~~~~
<source>:1:8: note: forward declaration of 'incomplete'
    1 | struct incomplete;
      |        ^
```

Compiler Explorer: https://godbolt.org/z/fPo1W7c1n
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzsVM1u3CAQfprxBWWFB7O2Dz54nfW1vfWMgfVSYWMBziY59NkrnLRJuln11lMtpPEIMd-P4BMhmHHWugF-AH6fiTWenW-eL6sJ2eDUU9NZMY9ETyYGotbFGimiJsqIcXYhGhnI5axnIt20GGvmkcSzJidnrbukTjqliZlJB3gAPCAFPJDJKQ2sBbqtPX1ZclmAtiH6VUZi5jTR6qiBHYC27_sWWBufFk0ehH_Z_T3jZeSXNS5rvEaIjzG1rAtu9VIDOwJrEVibA2uJ9t759POGRTYYwPIdPJZkFpNWSdWsQ9Rq60lYtDQno32C6BBaSl4LEig78hcFH078KmVHgB9_vH3X9BP1KrGe3TaZnJy_CK-I0tIKL6JxM3GnKxFXmPkGd8P-2_Q-3dgK8ON_t_-12x8fQre9Su3J8XGxzuvN8HOMS0iuYA_Yj04Nzsad8yNg_wzYn766_Fsp8zlTDVM1q0Wmm7zk-Z7uC15l56bmbM-HfVnsZVVLLFjFa7WXFS2KnBU5z0yDFDktaUE5Ul7tULFiOJUlDqouq5pCQfUkjN1Z-zAl7MyEsOomL0pKaWbFoG3YQglRpgQC1r7LHEBMaeWbdPxuWMcABbUmxPA2MJpot1zbEgz4Pbn_NL5uhNPVvbx1AbPV2-YPT008r8NOugmwT4Rey93i3XctI2C_yQ2A_avihwZ_BgAA__9aPKdF">