Skip to content

Commit

Permalink
Add comment for always_false
Browse files Browse the repository at this point in the history
  • Loading branch information
rwgk committed Dec 21, 2024
1 parent 9d46b4d commit 921657a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions include/pybind11/detail/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,11 @@ struct instance {
static_assert(std::is_standard_layout<instance>::value,
"Internal error: `pybind11::detail::instance` is not standard layout!");

// Some older compilers (e.g. gcc 9.4.0) require
// static_assert(always_false<T>::value, "...");
// instead of
// static_assert(false, "...");
// to trigger the static_assert() in a template only if it is actually instantiated.
template <typename>
struct always_false : std::false_type {};

Expand Down

0 comments on commit 921657a

Please sign in to comment.