Skip to content

Commit

Permalink
Fix SFINAE on gsl::owner. (#1174)
Browse files Browse the repository at this point in the history
`std::enable_if_t` must not be used as a default template argument, otherwise the instantiator will be able to override it freely with something that doesn't fail substitution. Instead, `std::enable_if_t` itself must be the type of the template argument.

More information in the examples here: https://en.cppreference.com/w/cpp/types/enable_if
  • Loading branch information
lord-pando authored Dec 13, 2024
1 parent 4b190d2 commit aed09c4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/gsl/pointers
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ using std::unique_ptr;
// T must be a pointer type
// - disallow construction from any type other than pointer type
//
template <class T, class = std::enable_if_t<std::is_pointer<T>::value>>
template <class T, std::enable_if_t<std::is_pointer<T>::value, bool> = true>
using owner = T;

//
Expand Down

0 comments on commit aed09c4

Please sign in to comment.