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

    <tr>
        <th>Summary</th>
        <td>
            Clang compile an invalid unbounded array declaration in a variable template
        </td>
    </tr>

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

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

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

<pre>
    With this code:

```cpp
template<class T, char fmt>
constexpr inline auto& to_print_fmt = "";

template<> constexpr inline char[] to_print_fmt<unsigned, 'x'> = "0x%x";
//                              ^^
```

Not error with clang-18,19,20 and trunk. But `[]` is misplaced, it should be after the variable name or in an alias (e.g. `std::type_identity_t<char[]>`)

```cpp
template<> constexpr inline char to_print_fmt<unsigned, 'x'>[] = "0x%x";
//                                                          ^^
```

Gcc:

```cpp
test.cpp:4:33: error: expected unqualified-id before ‘[’ token
    4 | template<> constexpr inline char[] to_print_fmt<unsigned, 'x'> = "0x%x";
      |                                 ^
```

https://gcc.godbolt.org/z/bPdT4o5r3
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy8lM9u5DYMxp-GvhAxZMl_xgcfJk6mt6KHBXoMZIkz1q4suZKcTvr0hTxTZNvFtoscahAwDxbJ7_eJljGaiyMaoHmE5qmQW5p9GD57J9Ms3erJkismr9-GX02aMc0movKaQByB7dGyW6h1BXZMtKxWJgIxKitjxE_AR1SzDHheEohnYEflXUx0XQMaZ40jlFvywFtM_mUNxqWX85IQxBMC5znE463XV8VBPOM3dXKbm5C_lQIxbm7XqfMwwLsr8C5XuPdgV-DN9b0TPwE_4b8-0Dzn-Er_bcSffUIKwQf8PfNSVrrLQ3UAPlY98JEzlE5jCpv7UuLjljCf3EeGlqGJuJi4Wqluo5qEcfab1TgRynOigGkmfJXByMkSOrkQ-qwfpUNpjYwI_EDlpcyFY9LZJ3FMbyu9GE0umfT2koG8o8qetAx4_19-fhf5j8G-G_Nx5B-x4yelvn9TYypzKo41iKMQII436_bkupJKpHFzv23SmrMh_WCyD2cfCOGZw4FBf8iq7nmPyX8hB-yYJ6oRuhH_pxt7h9CNPwTqG0pzSmvMnHYXLkqVF68nb1PpwwX46Q_gp-kX_an2TRCFHoTuRS8LGqquqXommkNfzEPLD0qrutKK6qY_9weaSLOaND-wtm2rwgyc8YZ1rKuaRrC-FI2WbaVlJWrZnnUHNaNFGlta-7rk3oWJcaOhqjshRGHlRDbuvyrO983KAJqnIgz5wMO0XSLUzJqY4nuJZJKlYcyfo_LLaizlZTHuVVqT_Z385jRplCHIN9SkrAwyGe_2tXpftr-8LLZgh38gM2neplL5Bfgpd76_HtbgP5NKwE-7kgj8dBfzOvA_AwAA___0aJZu">