diff options
author | Arthur O'Dwyer <arthur.j.odwyer@gmail.com> | 2020-03-23 13:01:11 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-23 10:01:11 -0700 |
commit | 6b271b7ecb388bf66a90016af93b3bb1fb359265 (patch) | |
tree | 8691e3bb7f626345a43fa452bc03d947eed33843 /samples | |
parent | 90f3b8e8c7038ff98749e3ee43f6b401447e097d (diff) | |
download | flatbuffers-6b271b7ecb388bf66a90016af93b3bb1fb359265.tar.gz flatbuffers-6b271b7ecb388bf66a90016af93b3bb1fb359265.tar.bz2 flatbuffers-6b271b7ecb388bf66a90016af93b3bb1fb359265.zip |
Fix Clang-trunk warnings about special members deprecated in C++20. (#5829)
For example:
include/flatbuffers/reflection.h:365:8: error: definition of implicit copy
constructor for 'pointer_inside_vector<flatbuffers::Table, unsigned char>'
is deprecated because it has a user-declared copy assignment operator
[-Werror,-Wdeprecated-copy]
void operator=(const pointer_inside_vector &piv);
^
It's unclear why the old code wanted to declare a public `operator=`
without defining it; that just seems like a misunderstanding of the C++03 idiom
for deleting a member function. And anyway, we don't *want* to delete the
assignment operator; these are polymorphic types that do not follow value
semantics and nobody should ever be trying to copy them. So the simplest fix
is just to go back to the Rule of Zero: remove the declaration of `operator=`
and let the compiler do what it wanted to do originally anyway.
"The best code is no code."
Also, update the generated .h files.
Fixes #5649.
Diffstat (limited to 'samples')
-rw-r--r-- | samples/monster_generated.h | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/samples/monster_generated.h b/samples/monster_generated.h index 4e49d5f9..00aa70b0 100644 --- a/samples/monster_generated.h +++ b/samples/monster_generated.h @@ -402,7 +402,6 @@ struct MonsterBuilder { : fbb_(_fbb) { start_ = fbb_.StartTable(); } - MonsterBuilder &operator=(const MonsterBuilder &); flatbuffers::Offset<Monster> Finish() { const auto end = fbb_.EndTable(start_); auto o = flatbuffers::Offset<Monster>(end); @@ -536,7 +535,6 @@ struct WeaponBuilder { : fbb_(_fbb) { start_ = fbb_.StartTable(); } - WeaponBuilder &operator=(const WeaponBuilder &); flatbuffers::Offset<Weapon> Finish() { const auto end = fbb_.EndTable(start_); auto o = flatbuffers::Offset<Weapon>(end); |