summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2020-06-13 17:27:49 -0400
committer AJR <ajrhacker@users.noreply.github.com>2020-06-13 17:27:49 -0400
commit0572ca886e98b5b8fba26dfb03c3a1664ed59ecd (patch)
tree895dc30120048ddc992c0c50083bcf734cb342cb
parent58f3c274f4542184b162c2c7dc8e515ba3ffeab5 (diff)
nl_setup.cpp: Fix for some compilers not being CWG 1579 compliant (nw)
-rw-r--r--src/lib/netlist/nl_setup.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/lib/netlist/nl_setup.cpp b/src/lib/netlist/nl_setup.cpp
index b6c466be6e7..0608ce6cd99 100644
--- a/src/lib/netlist/nl_setup.cpp
+++ b/src/lib/netlist/nl_setup.cpp
@@ -15,6 +15,13 @@
#include "solver/nld_solver.h"
+// Workaround for return value optimization failure in some older versions of clang
+#if defined(__APPLE__) && defined(__clang__) && __clang_major__ < 8
+#define MOVE_UNIQUE_PTR(x) (std::move(x))
+#else
+#define MOVE_UNIQUE_PTR(x) (x)
+#endif
+
namespace netlist
{
// ----------------------------------------------------------------------------------------
@@ -1597,7 +1604,7 @@ source_string_t::stream_ptr source_string_t::stream(const pstring &name)
plib::unused_var(name);
auto ret(std::make_unique<std::istringstream>(m_str));
ret->imbue(std::locale::classic());
- return ret;
+ return MOVE_UNIQUE_PTR(ret);
}
source_mem_t::stream_ptr source_mem_t::stream(const pstring &name)
@@ -1605,7 +1612,7 @@ source_mem_t::stream_ptr source_mem_t::stream(const pstring &name)
plib::unused_var(name);
auto ret(std::make_unique<std::istringstream>(m_str, std::ios_base::binary));
ret->imbue(std::locale::classic());
- return ret;
+ return MOVE_UNIQUE_PTR(ret);
}
source_file_t::stream_ptr source_file_t::stream(const pstring &name)