@@ -222,7 +222,7 @@ class cpp_function : public function {
222222 auto *rec = unique_rec.get ();
223223
224224 /* Store the capture object directly in the function record if there is enough space */
225- if (sizeof (capture) <= sizeof (rec->data )) {
225+ if PYBIND11_IF_CONSTEXPR (sizeof (capture) <= sizeof (rec->data )) {
226226 /* Without these pragmas, GCC warns that there might not be
227227 enough space to use the placement new operator. However, the
228228 'if' statement above ensures that this is the case. */
@@ -240,7 +240,7 @@ class cpp_function : public function {
240240
241241 // UB without std::launder, but without breaking ABI and/or
242242 // a significant refactoring it's "impossible" to solve.
243- if (!std::is_trivially_destructible<capture>::value) {
243+ if PYBIND11_IF_CONSTEXPR (!std::is_trivially_destructible<capture>::value) {
244244 rec->free_data = [](function_record *r) {
245245 auto data = PYBIND11_STD_LAUNDER ((capture *) &r->data );
246246 (void ) data;
@@ -349,7 +349,7 @@ class cpp_function : public function {
349349 using FunctionType = Return (*)(Args...);
350350 constexpr bool is_function_ptr
351351 = std::is_convertible<Func, FunctionType>::value && sizeof (capture) == sizeof (void *);
352- if (is_function_ptr) {
352+ if PYBIND11_IF_CONSTEXPR (is_function_ptr) {
353353 rec->is_stateless = true ;
354354 rec->data [1 ]
355355 = const_cast <void *>(reinterpret_cast <const void *>(&typeid (FunctionType)));
@@ -1595,7 +1595,7 @@ class class_ : public detail::generic_type {
15951595
15961596 generic_type::initialize (record);
15971597
1598- if (has_alias) {
1598+ if PYBIND11_IF_CONSTEXPR (has_alias) {
15991599 auto &instances = record.module_local ? get_local_internals ().registered_types_cpp
16001600 : get_internals ().registered_types_cpp ;
16011601 instances[std::type_index (typeid (type_alias))]
0 commit comments