@@ -36,7 +36,9 @@ struct Expr{
struct CodeEmitContext{
VM* vm;
CodeObject_ co;
- stack<Expr_> s_expr;
+ // some bugs on MSVC (error C2280) when using std::vector<Expr_>
+ // so we use stack_no_copy instead
+ stack_no_copy<Expr_> s_expr;
int level;
std::set<Str> global_names;
CodeEmitContext(VM* vm, CodeObject_ co, int level): vm(vm), co(co), level(level) {}
@@ -141,4 +141,14 @@ public:
Container& data() { return vec; }
};
+template <typename T, typename Container=std::vector<T>>
+class stack_no_copy: public stack<T, Container>{
+public:
+ stack_no_copy() = default;
+ stack_no_copy(const stack_no_copy& other) = delete;
+ stack_no_copy& operator=(const stack_no_copy& other) = delete;
+ stack_no_copy(stack_no_copy&& other) noexcept = default;
+ stack_no_copy& operator=(stack_no_copy&& other) noexcept = default;
+};
+
} // namespace pkpy