[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi] depr.impldec
From: |
Greg Chicares |
Subject: |
[lmi] depr.impldec |
Date: |
Sat, 9 Jul 2022 22:58:19 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 |
clang's '-Wdeprecated-copy-with-dtor' pointed out that we're relying
on a deprecated language feature [depr.impldec] in quite a few instances,
which I'd like to fix now, lest "deprecated" become "deleted".
Please review this branch:
https://git.savannah.nongnu.org/cgit/lmi.git/log/?h=odd/rules_of_n
It passes every nychthemeral test, specifically including a complete
clang UBSan build. The strategy used was:
- use the Rule of Zero where we can;
- else, use the Rule of Five.
Somewhere, Scott Meyers said he disliked the Rule of Zero because he
sometimes experimentally adds a dtor as a convenient debugger breakpoint,
and adding one instead of five special members can break things. I don't
think I've used a debugger successfully in the present century, though.
I was torn between writing "= default" vs. "= delete".
I was tempted to remove "virtual" from dtors for classes that don't
manage resources (i.e., most lmi classes except any_member), but that
would add an extra sub-rule to the strategy:
- when writing a non-virtual dtor for a polymorphic class, place it
it a "protected:" section; and turn off the compiler warning that'll
complain that the dtor isn't virtual
so I put that consideration aside in order to achieve the milestone,
because relying on a deprecated feature seems like a really bad idea.
Those are just my "known unknowns"; I'd be especially interested in
learning about any "unknown unknowns".