diff --git a/src/serac/physics/state/finite_element_state.hpp b/src/serac/physics/state/finite_element_state.hpp index ec0551be2a..6f46219e4f 100644 --- a/src/serac/physics/state/finite_element_state.hpp +++ b/src/serac/physics/state/finite_element_state.hpp @@ -16,6 +16,7 @@ #include #include #include +#include #include "mfem.hpp" @@ -73,7 +74,8 @@ decltype(first_argument_helper(&F::operator())) first_argument_helper(F); * Extract type of first argument of a free callable */ template -using first_argument = decltype(first_argument_helper(std::declval())); +using first_argument = typename std::remove_const< + typename std::remove_reference()))>::type>::type; /** * @brief Evaluate a function of a tensor with an mfem Vector object diff --git a/src/serac/physics/state/tests/test_finite_element_state.cpp b/src/serac/physics/state/tests/test_finite_element_state.cpp index 1988febca7..a17238bf36 100644 --- a/src/serac/physics/state/tests/test_finite_element_state.cpp +++ b/src/serac/physics/state/tests/test_finite_element_state.cpp @@ -47,7 +47,7 @@ TEST_F(TestFiniteElementState, SetScalarStateFromFieldFunction) // Set state with field function. // Check that lambda captures work with this. double c = 2.0; - auto scalar_field = [c](tensor X) -> double { return c * X[0]; }; + auto scalar_field = [c](const tensor& X) -> double { return c * X[0]; }; scalar_state.setFromFieldFunction(scalar_field); // Get the nodal positions corresponding to state dofs in a grid function