From 1b1a122b1f41956236b0c4b6e412d7566fde2b2d Mon Sep 17 00:00:00 2001 From: John Keiser Date: Sun, 21 Jun 2020 11:49:52 -0700 Subject: [PATCH] Fix copy constructor issue on older gcc --- include/simdjson/dom/document_stream.h | 3 +-- singleheader/amalgamate_demo.cpp | 2 +- singleheader/simdjson.cpp | 2 +- singleheader/simdjson.h | 14 +++++++------- tests/errortests.cpp | 21 ++++++--------------- 5 files changed, 16 insertions(+), 26 deletions(-) diff --git a/include/simdjson/dom/document_stream.h b/include/simdjson/dom/document_stream.h index a650bf4e..eb4f53c5 100644 --- a/include/simdjson/dom/document_stream.h +++ b/include/simdjson/dom/document_stream.h @@ -143,8 +143,7 @@ public: private: document_stream &operator=(const document_stream &) = delete; // Disallow copying - - document_stream(document_stream &other) = delete; // Disallow copying + document_stream(const document_stream &other) = delete; // Disallow copying /** * Construct a document_stream. Does not allocate or parse anything until the iterator is diff --git a/singleheader/amalgamate_demo.cpp b/singleheader/amalgamate_demo.cpp index 94f984a9..3dfbddcf 100644 --- a/singleheader/amalgamate_demo.cpp +++ b/singleheader/amalgamate_demo.cpp @@ -1,4 +1,4 @@ -/* auto-generated on Sat Jun 20 21:35:29 PDT 2020. Do not edit! */ +/* auto-generated on Sun Jun 21 11:49:12 PDT 2020. Do not edit! */ #include #include "simdjson.h" diff --git a/singleheader/simdjson.cpp b/singleheader/simdjson.cpp index ab26d2ad..d78ad5df 100644 --- a/singleheader/simdjson.cpp +++ b/singleheader/simdjson.cpp @@ -1,4 +1,4 @@ -/* auto-generated on Sat Jun 20 21:35:29 PDT 2020. Do not edit! */ +/* auto-generated on Sun Jun 21 11:49:12 PDT 2020. Do not edit! */ /* begin file src/simdjson.cpp */ #include "simdjson.h" diff --git a/singleheader/simdjson.h b/singleheader/simdjson.h index 0efec016..63a8f14e 100644 --- a/singleheader/simdjson.h +++ b/singleheader/simdjson.h @@ -1,4 +1,4 @@ -/* auto-generated on Sat Jun 20 21:50:03 PDT 2020. Do not edit! */ +/* auto-generated on Sun Jun 21 11:49:12 PDT 2020. Do not edit! */ /* begin file include/simdjson.h */ #ifndef SIMDJSON_H #define SIMDJSON_H @@ -3778,8 +3778,7 @@ public: private: document_stream &operator=(const document_stream &) = delete; // Disallow copying - - document_stream(document_stream &other) = delete; // Disallow copying + document_stream(const document_stream &other) = delete; // Disallow copying /** * Construct a document_stream. Does not allocate or parse anything until the iterator is @@ -3867,8 +3866,8 @@ private: #endif // SIMDJSON_THREADS_ENABLED friend class dom::parser; - friend class simdjson_result; - friend class internal::simdjson_result_base; + friend struct simdjson_result; + friend struct internal::simdjson_result_base; }; // class document_stream @@ -5574,7 +5573,6 @@ really_inline dom::document_stream::iterator simdjson_result::tie(T &value, error_code &error) && template WARN_UNUSED really_inline error_code simdjson_result_base::get(T &value) && noexcept { - return std::forward>(*this).get(value); + error_code error; + std::forward>(*this).tie(value, error); + return error; } template diff --git a/tests/errortests.cpp b/tests/errortests.cpp index 6af38277..3be94fcd 100644 --- a/tests/errortests.cpp +++ b/tests/errortests.cpp @@ -105,12 +105,8 @@ namespace parser_load { TEST_START(); dom::parser parser; dom::document_stream stream; - ASSERT_SUCCESS(parser.load_many(NONEXISTENT_FILE).get(stream)); - for (auto doc : stream) { - ASSERT_ERROR(doc.error(), IO_ERROR); - TEST_SUCCEED(); - } - TEST_FAIL("No documents returned"); + ASSERT_ERROR(parser.load_many(NONEXISTENT_FILE).get(stream), IO_ERROR); + TEST_SUCCEED(); } bool padded_string_load_nonexistent() { TEST_START(); @@ -122,21 +118,16 @@ namespace parser_load { bool parser_load_chain() { TEST_START(); dom::parser parser; - auto error = parser.load(NONEXISTENT_FILE)["foo"].get().error(); - ASSERT_ERROR(error, IO_ERROR); + UNUSED uint64_t foo; + ASSERT_ERROR( parser.load(NONEXISTENT_FILE)["foo"].get(foo) , IO_ERROR); TEST_SUCCEED(); } bool parser_load_many_chain() { TEST_START(); dom::parser parser; dom::document_stream stream; - ASSERT_SUCCESS( parser.load_many(NONEXISTENT_FILE).get(stream) ); - for (auto doc : stream) { - auto error = doc["foo"].get().error(); - ASSERT_ERROR(error, IO_ERROR); - TEST_SUCCEED(); - } - TEST_FAIL("No documents returned"); + ASSERT_ERROR( parser.load_many(NONEXISTENT_FILE).get(stream) , IO_ERROR ); + TEST_SUCCEED(); } bool run() { return true