@@ -3071,9 +3071,10 @@ struct luaw::pusher<luaw::class_tag> {
3071
3071
3072
3072
// Construct TargetT by Y at the moment of creating userdata.
3073
3073
template <typename TargetT, typename Y>
3074
- static std::enable_if_t <!std::is_same<TargetT, Y>::value &&
3075
- !std::is_reference<TargetT>::value,
3076
- int >
3074
+ static std::enable_if_t <
3075
+ !std::is_same<TargetT, Y>::value &&
3076
+ !std::is_same<std::decay_t <TargetT>, luaw::class_tag>::value,
3077
+ int >
3077
3078
push (luaw& l, Y&& v) {
3078
3079
static_assert (std::is_class<std::remove_pointer_t <TargetT>>::value,
3079
3080
" Only class or it's pointer" );
@@ -3114,10 +3115,11 @@ struct luaw::pusher {
3114
3115
3115
3116
static const size_t size = 1 ;
3116
3117
3118
+ // DecayY must be same as T
3117
3119
template <typename Y>
3118
3120
static int push (luaw& l, Y&& v) {
3119
3121
static_assert (std::is_same<std::decay_t <Y>, T>::value,
3120
- " DecayY should same to T" );
3122
+ " Decayed Y should be same type as T" );
3121
3123
using SolidY = std::remove_reference_t <Y>;
3122
3124
3123
3125
// Guess whether it may be a lambda object, if it is, then push as a
@@ -3128,10 +3130,8 @@ struct luaw::pusher {
3128
3130
3129
3131
// Construct TargetT by Y at the moment of creating userdata.
3130
3132
template <typename TargetT, typename Y>
3131
- static std::enable_if_t <!std::is_same<TargetT, Y>::value &&
3132
- !std::is_reference<TargetT>::value,
3133
- int >
3134
- push (luaw& l, Y&& v) {
3133
+ static std::enable_if_t <!std::is_same<TargetT, Y>::value, int > push (luaw& l,
3134
+ Y&& v) {
3135
3135
static_assert (std::is_class<TargetT>::value &&
3136
3136
std::is_same<std::remove_cv_t <TargetT>, T>::value,
3137
3137
" TargetT should be class T or cv- qualified T" );
0 commit comments