Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MacOS: ambiguous assignment. #1379

Closed
evoskuil opened this issue Jan 29, 2024 · 6 comments
Closed

MacOS: ambiguous assignment. #1379

evoskuil opened this issue Jan 29, 2024 · 6 comments
Assignees
Labels

Comments

@evoskuil
Copy link
Member

evoskuil commented Jan 29, 2024

  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;
            ^

https://github.com/libbitcoin/libbitcoin-system/actions/runs/7681642280/job/20949298358?pr=1378#step:8:884

@evoskuil evoskuil added the build label Jan 29, 2024
@evoskuil
Copy link
Member Author

#1378

@evoskuil evoskuil self-assigned this Jan 29, 2024
@evoskuil
Copy link
Member Author

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.

@evoskuil
Copy link
Member Author

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.

@evoskuil
Copy link
Member Author

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.

@evoskuil
Copy link
Member Author

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.

@evoskuil
Copy link
Member Author

Resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant