Skip to content

Commit a1cd376

Browse files
committed
fix: PGI compiler fix
1 parent be79610 commit a1cd376

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

include/pybind11/detail/common.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,8 +501,9 @@ template <bool... Bs> using select_indices = typename select_indices_impl<index_
501501
template <bool B> using bool_constant = std::integral_constant<bool, B>;
502502
template <typename T> struct negation : bool_constant<!T::value> { };
503503

504-
template <typename...> struct void_t_impl { using type = void; };
505-
template <typename... Ts> using void_t = typename void_t_impl<Ts...>::type;
504+
template <typename... >
505+
using void_t = void;
506+
506507

507508
/// Compile-time all/any/none of that check the boolean value of all template types
508509
#if defined(__cpp_fold_expressions) && !(defined(_MSC_VER) && (_MSC_VER < 1916))

tests/test_factory_constructors.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "pybind11_tests.h"
1212
#include "constructor_stats.h"
1313
#include <cmath>
14+
#include <new>
1415

1516
// Classes for testing python construction via C++ factory function:
1617
// Not publicly constructible, copyable, or movable:
@@ -298,11 +299,14 @@ TEST_SUBMODULE(factory_constructors, m) {
298299
static void *operator new(size_t, void *p) { py::print("noisy placement new"); return p; }
299300
static void operator delete(void *p, size_t) { py::print("noisy delete"); ::operator delete(p); }
300301
static void operator delete(void *, void *) { py::print("noisy placement delete"); }
301-
#if defined(__PGIC__) || (defined(_MSC_VER) && _MSC_VER < 1910)
302+
# if defined(_MSC_VER) && _MSC_VER < 1910
302303
// MSVC 2015 bug: the above "noisy delete" isn't invoked (fixed in MSVC 2017)
303-
static void operator delete(void *p) { py::print("noisy delete"); ::operator delete(p); }
304-
#endif
304+
static void operator delete(void *p) { py::print("noisy delete"); ::operator delete(p); }
305+
# endif
305306
};
307+
308+
static_assert(py::detail::has_operator_delete_size<NoisyAlloc>::value, "Must have sized delete");
309+
306310
py::class_<NoisyAlloc>(m, "NoisyAlloc")
307311
// Since these overloads have the same number of arguments, the dispatcher will try each of
308312
// them until the arguments convert. Thus we can get a pre-allocation here when passing a

0 commit comments

Comments
 (0)