Hi,
thanks for implementing constexpr for clang-19!
The following code
constexpr int category_width = 5;
int const w = 5;
int const* a = &category_width;
compiles, but produces an external symbol for category_width and then multiple defined symbol errors on linkage. So I cannot use constexpr in header files, or I'd have to prefix it with static, which defeats the purpose of constexpr ...
C23 has in 6.2.2 p3
If the declaration of a file scope identifier for:
— an object contains any of the storage-class specifiers static or constexpr;
— or, a function contains the storage-class specifier static,
then the identifier has internal linkage.
Hi,
thanks for implementing `constexpr` for clang-19!
The following code
```{.C}
constexpr int category_width = 5;
int const w = 5;
int const* a = &category_width;
```
compiles, but produces an external symbol for `category_width` and then multiple defined symbol errors on linkage. So I cannot use `constexpr` in header files, or I'd have to prefix it with `static`, which defeats the purpose of `constexpr` ...
C23 has in 6.2.2 p3
> If the declaration of a file scope identifier for:
> — an object contains any of the storage-class specifiers `static` or `constexpr`;
> — or, a function contains the storage-class specifier `static`,
> then the identifier has internal linkage.
Thanks
Jens
Hi, thanks for implementing
constexpr
for clang-19!The following code
compiles, but produces an external symbol for
category_width
and then multiple defined symbol errors on linkage. So I cannot useconstexpr
in header files, or I'd have to prefix it withstatic
, which defeats the purpose ofconstexpr
...C23 has in 6.2.2 p3
Thanks Jens