blueloveTH hai 1 ano
pai
achega
4e8b0ea9d5
Modificáronse 2 ficheiros con 2 adicións e 3 borrados
  1. 0 1
      include/pocketpy/common.h
  2. 2 2
      include/pocketpy/vm.h

+ 0 - 1
include/pocketpy/common.h

@@ -103,7 +103,6 @@ struct Type {
 	bool operator==(Type other) const { return this->index == other.index; }
 	bool operator!=(Type other) const { return this->index != other.index; }
     constexpr operator int() const { return index; }
-    constexpr operator bool() const { return index != 0; }
 };
 
 #define PK_LAMBDA(x) ([](VM* vm, ArgsView args) { return x; })

+ 2 - 2
include/pocketpy/vm.h

@@ -494,7 +494,7 @@ PyVar py_var(VM* vm, __T&& value){
         return from_void_p(vm, (void*)value);
     }else{
         constexpr Type const_type = _find_type_in_const_cxx_typeid_map<T>();
-        if constexpr(const_type){
+        if constexpr((bool)const_type){
             if constexpr(is_sso_v<T>) return PyVar(const_type, value);
             else return vm->heap.gcnew<T>(const_type, std::forward<__T>(value));
         }
@@ -550,7 +550,7 @@ __T _py_cast__internal(VM* vm, PyVar obj) {
         return to_void_p<T>(vm, obj);
     }else{
         constexpr Type const_type = _find_type_in_const_cxx_typeid_map<T>();
-        if constexpr(const_type){
+        if constexpr((bool)const_type){
             if constexpr(with_check){
                 if constexpr(std::is_same_v<T, Exception>){
                     // Exception is `subclass_enabled`