alexfh wrote:

It looks like the presence of `static` on template variable specializations 
makes difference in the namespace context: https://gcc.godbolt.org/z/b5ns1zhx6

Specifically, the specializations not marked `static` result in an exported 
variable. Thus, we have seemingly valid code that generates this diagnostic:
```
namespace A {
template <unsigned N, typename = std::enable_if_t<N >= 1 && N <= 64>>
static constexpr uint64_t kMaxUnsignedInt = 2 * kMaxUnsignedInt<N - 1> + 1;

template <>
static constexpr uint64_t kMaxUnsignedInt<1> = 1;
}
```

However, if we remove the `static` from the specialization, we're getting a 
potential ODR violation (considering this code can be in a header included into 
multiple translation units).

https://github.com/llvm/llvm-project/pull/93873
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to