MWE
source file
class A {
public:
explicit A(const char* person = "World"): person_(person){}
void say_hello() const{
std::cout << "Hello " << person_ << "!\n";
}
A& operator=(const A& a) = delete;
private:
std::string person_;
};
A global_variable;
codegen
// [...]
void add_methods() const{
auto& t = module_;
DEBUG_MSG("Adding global_variable methods to provide access to the global variable global_variable (" __HERE__ ")");
// defined in ./A.h:17:3
t.method("global_variable", []()-> A& { return global_variable; });
t.method("global_variable!", [](const A& val)-> A& { return global_variable = val; });
}
// [...]
The generated code does not compile, because the statement global_variable = val is invalid, as the assignment operation has been deleted. Codegen should skip generating the setter method in this case.
MWE
source file
codegen
The generated code does not compile, because the statement
global_variable = valis invalid, as the assignment operation has been deleted. Codegen should skip generating the setter method in this case.