Skip to content

Commit afe31e4

Browse files
committed
Fix MSVC warnings
1 parent 71c0aed commit afe31e4

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

include/inja/environment.hpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ class Environment {
3131
using BasicArg = std::remove_const_t<
3232
std::remove_pointer_t<std::remove_reference_t<std::decay_t<Arg>>>>;
3333

34-
constexpr bool is_valid_arg =
34+
static constexpr bool check =
3535
std::is_const_v<std::remove_reference_t<Arg>> ||
3636
std::is_same_v<BasicArg, Arg>;
37-
static_assert(is_valid_arg, "Arguments should be either const& or a value type");
37+
static_assert(check, "Arguments should be either const& or a value type");
3838

3939
if constexpr (std::is_same_v<BasicArg, json>) {
4040
return *args[index];
@@ -50,7 +50,8 @@ class Environment {
5050
function_signature::ArgsList<Args...> /*args*/,
5151
std::index_sequence<Is...> /*seq*/) {
5252
add_callback(name, sizeof...(Args),
53-
[func = std::move(func)](const Arguments &args) -> json {
53+
[func = std::move(func)] //
54+
([[maybe_unused]] const Arguments &args) -> json {
5455
if constexpr (std::is_same_v<Ret, void>) {
5556
func(get_callback_argument<Args>(args, Is)...);
5657
return {};
@@ -218,17 +219,18 @@ class Environment {
218219
*/
219220
template <class Callback>
220221
void add_callback(const std::string &name, Callback callback) {
221-
constexpr auto get_sig = [] {
222+
static constexpr auto get_sig = [] {
222223
if constexpr (std::is_class_v<Callback>) {
223224
return function_signature::Get<decltype(&Callback::operator())> {};
224225
} else {
225226
return function_signature::Get<Callback>{};
226227
}
227228
};
228229
using Sig = decltype(get_sig());
229-
constexpr size_t num_args = std::tuple_size_v<typename Sig::ArgsTuple>;
230+
static constexpr size_t num_args =
231+
std::tuple_size_v<typename Sig::ArgsTuple>;
230232

231-
constexpr auto is_arguments_vector = [] {
233+
static constexpr auto is_arguments_vector = [] {
232234
if constexpr (num_args == 1) {
233235
return std::is_same_v<
234236
std::remove_cv_t<std::remove_reference_t<

0 commit comments

Comments
 (0)