non-type template argument is not a constant expression
- Dominant language
- C++
- Stars
- 30.5k
- Forks
- 5.9k
- PR merge metrics
- No merged PRs in 30d
Description
/opt/homebrew/include/fmt/base.h:1209:15: note: candidate template ignored: requirement 'is_named_arg>::value' was not satisfied [with T = folly::Range]
1209 | static auto map(const T& named_arg) -> decltype(map(named_arg.value));
| ^
/opt/homebrew/include/fmt/base.h:2815:30: error: non-type template argument is not a constant expression
2815 | detail::make_descriptor()>;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/homebrew/include/fmt/format.h:4200:27: note: in instantiation of template type alias 'vargs' requested here
4200 | return vformat(fmt.str, vargs{{args...}});
| ^
/Users/chen/Desktop/c++/day02/build/_deps/folly-src/folly/IPAddress.cpp:123:43: note: in instantiation of function template specialization 'fmt::format, unsigned long>' requested here
123 | throw IPAddressFormatException(fmt::format(
template
using vargs =
detail::format_arg_store(),
detail::make_descriptor()>;
template
FMT_NODISCARD FMT_INLINE auto format(format_string fmt, T&&... args)
-> std::string {
return vformat(fmt.str, vargs{{args...}});
}
throw IPAddressFormatException(fmt::format(
"CIDR value '{}' is > network bit count '{}'",
vec.size() == 2 ? vec.at(1) : to(cidr),
subnet.bitCount()));
non-type template argument is not a constant expression
Contributor guide
Research direction
Reproduce the compilation failure and inspect folly/IPAddress.cpp at line 123, then trace the reported template instantiations through fmt/base.h and fmt/format.h. Done means the affected build completes without the non-type template argument constant-expression error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100