MacOS: ambiguous assignment.
evoskuil opened this issue · comments
CXX src/chain/libbitcoin_system_la-operation.lo
src/chain/input.cpp:344:9: error: use of overloaded operator '=' is ambiguous (with operand types 'chain::script' and 'void')
out = { ops.back().data(), false };
~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/bitcoin/system/chain/script.hpp:460:13: note: candidate function
script& operator=(script&& other) NOEXCEPT;
^
./include/bitcoin/system/chain/script.hpp:461:13: note: candidate function
script& operator=(const script& other) NOEXCEPT;
^
Seems incorrect that the compiler would interpret a prvalue as an rvalue, and otherwise there would be no ambiguity (which is the case with all but xcode). So prob just have to work around this.
More detail after small change:
CXX src/chain/libbitcoin_system_la-output.lo
src/chain/input.cpp:346:21: error: call to constructor of 'chain::script' is ambiguous
out = std::move(chain::script{ ops.back().data(), false });
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/bitcoin/system/chain/script.hpp:445:5: note: candidate constructor
script(const data_slice& data, bool prefix) NOEXCEPT;
^
./include/bitcoin/system/chain/script.hpp:446:5: note: candidate constructor
script(stream::in::fast&& stream, bool prefix) NOEXCEPT;
^
src/chain/input.cpp:346:11: warning: moving a temporary object prevents copy elision [-Wpessimizing-move]
out = std::move(chain::script{ ops.back().data(), false });
^
src/chain/input.cpp:346:11: note: remove std::move call here
out = std::move(chain::script{ ops.back().data(), false });
^~~~~~~~~~ ~
1 warning and 1 error generated.
More detail after small change:
src/chain/input.cpp:346:11: error: call to constructor of 'chain::script' is ambiguous
out = chain::script{ ops.back().data(), false };
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/bitcoin/system/chain/script.hpp:445:5: note: candidate constructor
script(const data_slice& data, bool prefix) NOEXCEPT;
^
./include/bitcoin/system/chain/script.hpp:446:5: note: candidate constructor
script(stream::in::fast&& stream, bool prefix) NOEXCEPT;
^
1 error generated.
Seems incorrect that the compiler would interpret a prvalue as an rvalue, and otherwise there would be no ambiguity (which is the case with all but xcode). So prob just have to work around this.
The initial error appear to refer to the script assignment/copy constructor, but actually refers to other constructors. These have been made ambiguous as a result of the addition of the fast stream constructor.
Resolved.