Commit 45b27dba authored by Matthew Fernandez's avatar Matthew Fernandez
Browse files

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
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment