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

    <tr>
        <th>Summary</th>
        <td>
            storage specifiers not respected on specialized template constexpr variables yet warning is thrown
        </td>
    </tr>

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

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

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

<pre>
    Problem:

- Given a template static constexpr variable in a .hpp, along with some specializations, clang, unlike MSVC and GCC emits non-weak symbols in all the TUs which causes duplicate symbol link errors.

```c++
template <typename T>
static const constexpr std::nullptr_t my_map = nullptr;

template <>
// gcc, msvc -> no duplicate symbol errors; all is fine
// clang 10 .. 19 -> link errors due to duplicate symbols
const constexpr int my_map<int> = 1;

template <>
// gcc, msvc -> fail to compile 
// clang 10 .. 18 -> ok
// clang 19 -> throws a warning here but still does not respect the original static storage class and behaves like previous clang versions in terms of emitted symbols.
static const constexpr int my_map<float> = 2;
```

- If the specializations are marked static, then clang does not cause the duplicate symbol error anymore. But clang-19 now warns: "explicit specialization cannot have a storage class [-Wexplicit-specialization-storage-class]_" despite honoring it.

Full repro: https://gcc.godbolt.org/z/3cqnonv4Y
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVMGOozgQ_RrnUgKB6aTJgUMnPRntYaWVdnZXe2oZU4AnxmbtIpnM169sknSSnt3LSChBUPXqvccrC-9VZxArttyw5etCTNRbV32VqNEpdIvaNqfqN2drjQMrXlj2yrLzbwKf1QENCCAcRi0IwZMgJUFa4wm_jQ4OwilRawQV6tJ-HBnfgtDWdHBU1IO3A4IfUSqh1XdByhofSqQWpgs3k9Fqj_Dr739uQZgGPm-3gIMiD8aa5IhiD_401Fb7OENroB7hyx8ejr2SPUgxefTQTKNWMnKM1aCV2QM6Z51Pb1WxVTZfkvFNuOLTq0JWbOk0ohE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