Repository navigation
Open
Description
There's a bug in clang when compiling with -std=26, and reflectcpp is hit by that.
e.hpp:23:10: error: no matching constructor for initialization of 'internal::StringLiteral<5>'
23 | return internal::StringLiteral<5>('f',
| ^ ~~~~
24 | static_cast<char>('0' + ((_i / 100) % 10)),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
25 | static_cast<char>('0' + ((_i / 10) % 10)),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
26 | static_cast<char>('0' + (_i % 10)));
...
include/rfl/json/../parsing/../internal/StringLiteral.hpp:21:13: note: candidate constructor not viable: requires single argument '_arr', but 4 arguments were provided
21 | constexpr StringLiteral(const std::array<char, N> _arr) : arr_(_arr) {}
...
/home/anderswind/projects/eex-logger/build/vcpkg_installed/high-performance-x64-linux/include/rfl/json/../parsing/../internal/StringLiteral.hpp:17:13: note: candidate template ignored: constraints not satisfied [with _chars:auto = <char, char, char, char>]
17 | constexpr StringLiteral(const auto... _chars)
Apparently the concept of the variadic char constructor is not being hit because the char's are char not const char
Link to clang bug report: llvm/llvm-project#238720
One way to work around it is the following git diff
diff --git a/include/rfl/internal/StringLiteral.hpp b/include/rfl/internal/StringLiteral.hpp
--- a/include/rfl/internal/StringLiteral.hpp
+++ b/include/rfl/internal/StringLiteral.hpp
@@ -14,8 +14,9 @@
/// for the parameters names in the NamedTuples.
template <size_t N>
struct StringLiteral {
- constexpr StringLiteral(const auto... _chars)
- requires (std::is_same_v<decltype(_chars), const char> && ...)
+ template <class... Cs>
+ constexpr StringLiteral(const Cs... _chars)
+ requires (std::is_same_v<Cs, char> && ...)
: arr_{_chars..., '\0'} {}
constexpr StringLiteral(const std::array<char, N> _arr) : arr_(_arr) {}
Metadata
Metadata
Assignees
Labels
No labels
Activity
[-]Clang-23 compilation[/-][+]Clang-23 compilation error with -std=26[/+]liuzicheng1987 commentedon Nov 5, 2026
@anders-wind OK. Since you seem to have a fix, could you open a PR?
anders-wind commentedon Nov 5, 2026
Looks like it might have been fixed in the meantime since the latest release. Ill check