Skip to content

Commit 1b1a122

Browse files
committed
Fix copy constructor issue on older gcc
1 parent ae1bd89 commit 1b1a122

File tree

5 files changed

+16
-26
lines changed

5 files changed

+16
-26
lines changed

include/simdjson/dom/document_stream.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,7 @@ class document_stream {
143143
private:
144144

145145
document_stream &operator=(const document_stream &) = delete; // Disallow copying
146-
147-
document_stream(document_stream &other) = delete; // Disallow copying
146+
document_stream(const document_stream &other) = delete; // Disallow copying
148147

149148
/**
150149
* Construct a document_stream. Does not allocate or parse anything until the iterator is

singleheader/amalgamate_demo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* auto-generated on Sat Jun 20 21:35:29 PDT 2020. Do not edit! */
1+
/* auto-generated on Sun Jun 21 11:49:12 PDT 2020. Do not edit! */
22

33
#include <iostream>
44
#include "simdjson.h"

singleheader/simdjson.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* auto-generated on Sat Jun 20 21:35:29 PDT 2020. Do not edit! */
1+
/* auto-generated on Sun Jun 21 11:49:12 PDT 2020. Do not edit! */
22
/* begin file src/simdjson.cpp */
33
#include "simdjson.h"
44

singleheader/simdjson.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* auto-generated on Sat Jun 20 21:50:03 PDT 2020. Do not edit! */
1+
/* auto-generated on Sun Jun 21 11:49:12 PDT 2020. Do not edit! */
22
/* begin file include/simdjson.h */
33
#ifndef SIMDJSON_H
44
#define SIMDJSON_H
@@ -3778,8 +3778,7 @@ class document_stream {
37783778
private:
37793779

37803780
document_stream &operator=(const document_stream &) = delete; // Disallow copying
3781-
3782-
document_stream(document_stream &other) = delete; // Disallow copying
3781+
document_stream(const document_stream &other) = delete; // Disallow copying
37833782

37843783
/**
37853784
* Construct a document_stream. Does not allocate or parse anything until the iterator is
@@ -3867,8 +3866,8 @@ class document_stream {
38673866
#endif // SIMDJSON_THREADS_ENABLED
38683867

38693868
friend class dom::parser;
3870-
friend class simdjson_result<dom::document_stream>;
3871-
friend class internal::simdjson_result_base<dom::document_stream>;
3869+
friend struct simdjson_result<dom::document_stream>;
3870+
friend struct internal::simdjson_result_base<dom::document_stream>;
38723871

38733872
}; // class document_stream
38743873

@@ -5574,7 +5573,6 @@ really_inline dom::document_stream::iterator simdjson_result<dom::document_strea
55745573
}
55755574
#endif // SIMDJSON_EXCEPTIONS
55765575

5577-
55785576
} // namespace simdjson
55795577
#endif // SIMDJSON_INLINE_DOCUMENT_STREAM_H
55805578
/* end file include/simdjson/inline/document_stream.h */
@@ -6302,7 +6300,9 @@ really_inline void simdjson_result_base<T>::tie(T &value, error_code &error) &&
63026300

63036301
template<typename T>
63046302
WARN_UNUSED really_inline error_code simdjson_result_base<T>::get(T &value) && noexcept {
6305-
return std::forward<simdjson_result_base<T>>(*this).get(value);
6303+
error_code error;
6304+
std::forward<simdjson_result_base<T>>(*this).tie(value, error);
6305+
return error;
63066306
}
63076307

63086308
template<typename T>

tests/errortests.cpp

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,8 @@ namespace parser_load {
105105
TEST_START();
106106
dom::parser parser;
107107
dom::document_stream stream;
108-
ASSERT_SUCCESS(parser.load_many(NONEXISTENT_FILE).get(stream));
109-
for (auto doc : stream) {
110-
ASSERT_ERROR(doc.error(), IO_ERROR);
111-
TEST_SUCCEED();
112-
}
113-
TEST_FAIL("No documents returned");
108+
ASSERT_ERROR(parser.load_many(NONEXISTENT_FILE).get(stream), IO_ERROR);
109+
TEST_SUCCEED();
114110
}
115111
bool padded_string_load_nonexistent() {
116112
TEST_START();
@@ -122,21 +118,16 @@ namespace parser_load {
122118
bool parser_load_chain() {
123119
TEST_START();
124120
dom::parser parser;
125-
auto error = parser.load(NONEXISTENT_FILE)["foo"].get<uint64_t>().error();
126-
ASSERT_ERROR(error, IO_ERROR);
121+
UNUSED uint64_t foo;
122+
ASSERT_ERROR( parser.load(NONEXISTENT_FILE)["foo"].get(foo) , IO_ERROR);
127123
TEST_SUCCEED();
128124
}
129125
bool parser_load_many_chain() {
130126
TEST_START();
131127
dom::parser parser;
132128
dom::document_stream stream;
133-
ASSERT_SUCCESS( parser.load_many(NONEXISTENT_FILE).get(stream) );
134-
for (auto doc : stream) {
135-
auto error = doc["foo"].get<uint64_t>().error();
136-
ASSERT_ERROR(error, IO_ERROR);
137-
TEST_SUCCEED();
138-
}
139-
TEST_FAIL("No documents returned");
129+
ASSERT_ERROR( parser.load_many(NONEXISTENT_FILE).get(stream) , IO_ERROR );
130+
TEST_SUCCEED();
140131
}
141132
bool run() {
142133
return true

0 commit comments

Comments
 (0)