make copy constructor/assignment protected on abstract AST classes
In general, it is unsafe to use the copy constructors except on derived classes. Using them – either explicitly or implicitly – can cause object slicing. The exception is within the `clone` functions where the copy constructors are used in a controlled way. Making them protected guards against users accidentally calling them, inline with C++ Core Guideline C.67, “A polymorphic class should suppress public copy/move.”⁰ ⁰ https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Rc-copy-virtual
parent
0546a5d8
Please register or sign in to comment