From 25be6986e57be0bfea0b3616decaaa8e5b16876d Mon Sep 17 00:00:00 2001 From: john bowen Date: Wed, 6 Sep 2023 18:32:16 -0700 Subject: [PATCH] Add static assert for generic lambdas --- src/serac/physics/heat_transfer.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/serac/physics/heat_transfer.hpp b/src/serac/physics/heat_transfer.hpp index 81eaa354c..cfcc765e0 100644 --- a/src/serac/physics/heat_transfer.hpp +++ b/src/serac/physics/heat_transfer.hpp @@ -280,6 +280,16 @@ class HeatTransfer, std::integer_sequ struct ThermalMaterialIntegrand { ThermalMaterialIntegrand(MaterialType material) : material_(material) {} + // The template parameter MaterialType is meant to be a callable functor. Due + // to nvcc's lack of support for generic lambdas (i.e. functions of the form + // auto lambda = [](auto) {}; ), this cannot be allowed. In order for this code + // to be portable to CUDA platforms, the asserts below prevent serac from compiling + // if such a lambda is supplied. + class DummyArgumentType {}; + static_assert(!std::is_invocable::value); + static_assert(!std::is_invocable::value); + static_assert(!std::is_invocable::value); + template auto operator()(X x, T temperature, dT_dt dtemp_dt, Shape shape, Params... params) {