avoid declaring t1 outside lambda

clang doesn't want us to capture t1, and g++-14 requires us
to capture t1. this workaround avoids warnings with both.
This commit is contained in:
Arne Morten Kvarving 2024-10-17 12:21:56 +02:00
parent 0af94eef27
commit 501ee0f818

View File

@ -272,13 +272,12 @@ bool DamarisVar<T>::TestType(const std::string& variable_name)
has_error_ = true;
return false;
}
T test_id;
const std::type_info& t1 = typeid(test_id);
auto check = [&variable_name,this](auto td)
{
const std::type_info& t1 = typeid(T);
const std::type_info& t2 = typeid(td);
if (t1 != t2) {
if (typeid(T) != t2) {
formatTypeError(variable_name, t1.name(), t2.name());
return false;
}