diff --git a/lib/checkclass.cpp b/lib/checkclass.cpp index 7d796d3e7..dd55a2a87 100644 --- a/lib/checkclass.cpp +++ b/lib/checkclass.cpp @@ -425,12 +425,16 @@ bool CheckClass::canNotMove(const Scope *scope) constructor = true; if (func->access != Public) continue; - if (func->type == Function::eCopyConstructor) + if (func->type == Function::eCopyConstructor) { publicCopy = true; - else if (func->type == Function::eMoveConstructor) + break; + } else if (func->type == Function::eMoveConstructor) { publicMove = true; - else if (func->type == Function::eOperatorEqual) + break; + } else if (func->type == Function::eOperatorEqual) { publicAssign = true; + break; + } } return constructor && !(publicAssign || publicCopy || publicMove);