wxWidgets / wxWidgets

Cross-Platform C++ GUI Library
https://www.wxwidgets.org/
5.77k stars 1.7k forks source link

Explicitly define copy ctors etc in classes with virtual dtors #24502

Closed vadz closed 2 weeks ago

vadz commented 3 weeks ago

This avoids gcc 14 giving -Wdeprecated-copy-dtor for these classes.

This warning was fixed by fc35ad92bb (Remove unnecessary empty destructors, 2024-01-26) in master, but we can't remove the dtors in this branch, so add copy ctors and assignment operators here using new wxDECLARE_DEFAULT_COPY() and wxDECLARE_DEFAULT_COPY_AND_DEF() macros, which can be fine-tuned later (e.g. to do it only for gcc 14, if it has any adverse effects on some other compiler) if necessary.

Note that this also required adding some default ctors, as adding the copy ctor suppressed the generation of the default compiler-generated default ctor.