// P2280R4 - Using unknown pointers and references in constant expressions // PR c++/106650 // { dg-do compile { target c++17 } } #include template constexpr bool is_type(U &&) { return std::is_same_v>; } auto visitor = [](auto&& v) { if constexpr(is_type(v)) { // ... } else if constexpr(is_type(v)) { // ... } }; void g (int i) { visitor (i); constexpr bool b = is_type(i); }