Issue |
147333
|
Summary |
Clang compile an invalid unbounded array declaration in a variable template
|
Labels |
clang
|
Assignees |
|
Reporter |
jonathanpoelen
|
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
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs