Skip to content

Commit

Permalink
implicitly_convertible: don't accept enum targets (fixes #871)
Browse files Browse the repository at this point in the history
  • Loading branch information
wjakob committed Jan 27, 2025
1 parent 92d9cb3 commit be0c7e6
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions include/nanobind/nb_class.h
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,7 @@ template <typename T> class enum_ : public object {

template <typename Source, typename Target> void implicitly_convertible() {
using Caster = detail::make_caster<Source>;
static_assert(!std::is_enum_v<Target>, "implicitly_convertible(): 'Target' cannot be an enumeration.");

if constexpr (detail::is_base_caster_v<Caster>) {
detail::implicitly_convertible(&typeid(Source), &typeid(Target));
Expand Down

0 comments on commit be0c7e6

Please sign in to comment.