summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorArthur O'Dwyer <arthur.j.odwyer@gmail.com>2020-03-23 13:01:11 -0400
committerGitHub <noreply@github.com>2020-03-23 10:01:11 -0700
commit6b271b7ecb388bf66a90016af93b3bb1fb359265 (patch)
tree8691e3bb7f626345a43fa452bc03d947eed33843 /include
parent90f3b8e8c7038ff98749e3ee43f6b401447e097d (diff)
downloadflatbuffers-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 'include')
-rw-r--r--include/flatbuffers/reflection.h1
-rw-r--r--include/flatbuffers/reflection_generated.h9
2 files changed, 0 insertions, 10 deletions
diff --git a/include/flatbuffers/reflection.h b/include/flatbuffers/reflection.h
index f606b7b5..1c49234f 100644
--- a/include/flatbuffers/reflection.h
+++ b/include/flatbuffers/reflection.h
@@ -362,7 +362,6 @@ template<typename T, typename U> class pointer_inside_vector {
reinterpret_cast<uint8_t *>(flatbuffers::vector_data(vec_)) + offset_);
}
T *operator->() const { return operator*(); }
- void operator=(const pointer_inside_vector &piv);
private:
size_t offset_;
diff --git a/include/flatbuffers/reflection_generated.h b/include/flatbuffers/reflection_generated.h
index e7237ff2..cd783793 100644
--- a/include/flatbuffers/reflection_generated.h
+++ b/include/flatbuffers/reflection_generated.h
@@ -161,7 +161,6 @@ struct TypeBuilder {
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
- TypeBuilder &operator=(const TypeBuilder &);
flatbuffers::Offset<Type> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<Type>(end);
@@ -225,7 +224,6 @@ struct KeyValueBuilder {
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
- KeyValueBuilder &operator=(const KeyValueBuilder &);
flatbuffers::Offset<KeyValue> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<KeyValue>(end);
@@ -325,7 +323,6 @@ struct EnumValBuilder {
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
- EnumValBuilder &operator=(const EnumValBuilder &);
flatbuffers::Offset<EnumVal> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<EnumVal>(end);
@@ -448,7 +445,6 @@ struct EnumBuilder {
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
- EnumBuilder &operator=(const EnumBuilder &);
flatbuffers::Offset<Enum> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<Enum>(end);
@@ -617,7 +613,6 @@ struct FieldBuilder {
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
- FieldBuilder &operator=(const FieldBuilder &);
flatbuffers::Offset<Field> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<Field>(end);
@@ -773,7 +768,6 @@ struct ObjectBuilder {
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
- ObjectBuilder &operator=(const ObjectBuilder &);
flatbuffers::Offset<Object> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<Object>(end);
@@ -898,7 +892,6 @@ struct RPCCallBuilder {
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
- RPCCallBuilder &operator=(const RPCCallBuilder &);
flatbuffers::Offset<RPCCall> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<RPCCall>(end);
@@ -1007,7 +1000,6 @@ struct ServiceBuilder {
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
- ServiceBuilder &operator=(const ServiceBuilder &);
flatbuffers::Offset<Service> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<Service>(end);
@@ -1123,7 +1115,6 @@ struct SchemaBuilder {
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
- SchemaBuilder &operator=(const SchemaBuilder &);
flatbuffers::Offset<Schema> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<Schema>(end);