summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVladimir Glavnyy <31897320+vglavnyy@users.noreply.github.com>2020-03-13 02:07:27 +0700
committerGitHub <noreply@github.com>2020-03-12 12:07:27 -0700
commit45a2b07cbd83c14c233bafd0f7d850bc52f9aa24 (patch)
tree3a2793965c1178d0b7cecc00f2004351f9f4f81e /src
parentd10c16314298ee1b726fd3544cc7a396b80db62b (diff)
downloadflatbuffers-45a2b07cbd83c14c233bafd0f7d850bc52f9aa24.tar.gz
flatbuffers-45a2b07cbd83c14c233bafd0f7d850bc52f9aa24.tar.bz2
flatbuffers-45a2b07cbd83c14c233bafd0f7d850bc52f9aa24.zip
Remove `noexcept` qualifier copy-ctor of `union` type (#5800) (#5802)
- Remove `noexcept` qualifier from generated 'union' copy-constructor - Remove `noexcept` qualifier from generated 'union' assign-operator
Diffstat (limited to 'src')
-rw-r--r--src/idl_gen_cpp.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/idl_gen_cpp.cpp b/src/idl_gen_cpp.cpp
index 9903ae49..f78ee268 100644
--- a/src/idl_gen_cpp.cpp
+++ b/src/idl_gen_cpp.cpp
@@ -1227,10 +1227,8 @@ class CppGenerator : public BaseGenerator {
code_ += " {{NAME}}Union({{NAME}}Union&& u) FLATBUFFERS_NOEXCEPT :";
code_ += " type({{NONE}}), value(nullptr)";
code_ += " { std::swap(type, u.type); std::swap(value, u.value); }";
- code_ += " {{NAME}}Union(const {{NAME}}Union &) FLATBUFFERS_NOEXCEPT;";
- code_ +=
- " {{NAME}}Union &operator=(const {{NAME}}Union &u) "
- "FLATBUFFERS_NOEXCEPT";
+ code_ += " {{NAME}}Union(const {{NAME}}Union &);";
+ code_ += " {{NAME}}Union &operator=(const {{NAME}}Union &u)";
code_ +=
" { {{NAME}}Union t(u); std::swap(type, t.type); std::swap(value, "
"t.value); return *this; }";
@@ -1469,8 +1467,7 @@ class CppGenerator : public BaseGenerator {
// Union copy constructor
code_ +=
"inline {{ENUM_NAME}}Union::{{ENUM_NAME}}Union(const "
- "{{ENUM_NAME}}Union &u) FLATBUFFERS_NOEXCEPT : type(u.type), "
- "value(nullptr) {";
+ "{{ENUM_NAME}}Union &u) : type(u.type), value(nullptr) {";
code_ += " switch (type) {";
for (auto it = enum_def.Vals().begin(); it != enum_def.Vals().end();
++it) {