Page MenuHomePhabricator

refactor: Fix clang compile failure
ClosedPublic

Authored by PiRK on Aug 27 2021, 13:50.

Details

Reviewers
majcosta
Fabien
Group Reviewers
Restricted Project
Commits
rABC62401bcf2f00: refactor: Fix clang compile failure
Summary
script/standard.cpp:278:22: error: default initialization of an object of const type 'const (anonymous namespace)::CScriptVisitor' without a user-provided default constructor
const CScriptVisitor g_script_visitor;
                     ^
                                     {}
1 error generated.

This is a backport of core#19333 and core#19428

Test Plan

ninja all check-all

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

PiRK requested review of this revision.Aug 27 2021, 13:50

Tail of the build log:

[338/509] Building CXX object src/CMakeFiles/server.dir/rpc/mining.cpp.o
[339/509] Linking C executable src/secp256k1/verify-bench
[340/509] Linking C executable src/secp256k1/recover-bench
[341/509] Installing component secp256k1
-- Install configuration: "RelWithDebInfo"
-- Install component: "secp256k1"
-- Installing: /results/artifacts/lib/libsecp256k1.a
-- Installing: /results/artifacts/include/secp256k1.h
-- Installing: /results/artifacts/include/secp256k1_preallocated.h
-- Installing: /results/artifacts/include/secp256k1_recovery.h
-- Installing: /results/artifacts/include/secp256k1_schnorr.h
[342/509] Building CXX object src/test/CMakeFiles/testutil.dir/util/mining.cpp.o
[343/509] Building CXX object src/test/CMakeFiles/testutil.dir/util/str.cpp.o
[344/509] Building CXX object src/test/CMakeFiles/testutil.dir/util/net.cpp.o
[345/509] Building CXX object src/test/CMakeFiles/testutil.dir/util/transaction_utils.cpp.o
[346/509] Building CXX object src/CMakeFiles/server.dir/rpc/misc.cpp.o
[347/509] Building CXX object src/CMakeFiles/script.dir/script/standard.cpp.o
FAILED: src/CMakeFiles/script.dir/script/standard.cpp.o 
/usr/bin/ccache /usr/bin/clang++  -DBOOST_AC_USE_STD_ATOMIC -DBOOST_SP_USE_STD_ATOMIC -DBUILD_BITCOIN_INTERNAL -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -I../../src/. -Isrc -I../../src/univalue/include -Isrc/crypto/.. -I../../src/secp256k1/include -isystem /usr/include/jemalloc -Werror -g -O2 -fPIC -fvisibility=hidden   -fstack-protector-all -Wstack-protector -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wformat -Wgnu -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wthread-safety -Wrange-loop-analysis -Wredundant-decls -Wunreachable-code-loop-increment -Wsign-compare -Wconditional-uninitialized -Wformat-security -Wredundant-move -Wshadow -Wshadow-field -Wno-unused-parameter -Wno-implicit-fallthrough -pthread -std=gnu++17 -MD -MT src/CMakeFiles/script.dir/script/standard.cpp.o -MF src/CMakeFiles/script.dir/script/standard.cpp.o.d -o src/CMakeFiles/script.dir/script/standard.cpp.o -c ../../src/script/standard.cpp
../../src/script/standard.cpp:244:48: error: temporary of type 'boost::static_visitor<CScript>' has protected destructor
    return boost::apply_visitor(CScriptVisitor{}, dest);
                                               ^
/usr/include/boost/variant/static_visitor.hpp:53:5: note: declared protected here
    ~static_visitor() = default;
    ^
1 error generated.
[348/509] Building CXX object src/wallet/CMakeFiles/wallet.dir/bdb.cpp.o
[349/509] Building CXX object src/wallet/CMakeFiles/wallet.dir/coincontrol.cpp.o
[350/509] Building CXX object src/wallet/CMakeFiles/wallet.dir/coinselection.cpp.o
[351/509] Building CXX object src/wallet/CMakeFiles/wallet.dir/context.cpp.o
[352/509] Building CXX object src/wallet/CMakeFiles/wallet.dir/crypter.cpp.o
[353/509] Building CXX object src/wallet/CMakeFiles/wallet.dir/db.cpp.o
[354/509] Building CXX object src/CMakeFiles/server.dir/wallet/init.cpp.o
[355/509] Building CXX object src/CMakeFiles/bitcoin-wallet.dir/bitcoin-wallet.cpp.o
[356/509] Building CXX object src/CMakeFiles/server.dir/txmempool.cpp.o
[357/509] Building CXX object src/CMakeFiles/server.dir/rpc/net.cpp.o
[358/509] Building CXX object src/test/CMakeFiles/testutil.dir/util/wallet.cpp.o
[359/509] Building CXX object src/wallet/CMakeFiles/wallet.dir/scriptpubkeyman.cpp.o
[360/509] Building CXX object src/wallet/CMakeFiles/wallet.dir/fees.cpp.o
[361/509] Building CXX object src/wallet/CMakeFiles/wallet-tool.dir/wallettool.cpp.o
[362/509] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletutil.cpp.o
[363/509] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/bitcoin.cpp.o
[364/509] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/db.cpp.o
[365/509] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/dns.cpp.o
[366/509] Building CXX object src/seeder/CMakeFiles/bitcoin-seeder.dir/main.cpp.o
[367/509] Building CXX object src/wallet/CMakeFiles/wallet.dir/load.cpp.o
[368/509] Building CXX object src/test/CMakeFiles/testutil.dir/util/setup_common.cpp.o
[369/509] Building CXX object src/CMakeFiles/server.dir/init.cpp.o
[370/509] Building CXX object src/CMakeFiles/server.dir/rpc/blockchain.cpp.o
[371/509] Building CXX object src/wallet/CMakeFiles/wallet.dir/salvage.cpp.o
[372/509] Building CXX object src/wallet/CMakeFiles/wallet.dir/__/interfaces/wallet.cpp.o
[373/509] Building CXX object src/CMakeFiles/server.dir/rpc/rawtransaction.cpp.o
[374/509] Building CXX object src/CMakeFiles/server.dir/net_processing.cpp.o
[375/509] Building CXX object src/CMakeFiles/server.dir/validation.cpp.o
[376/509] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletdb.cpp.o
[377/509] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpcdump.cpp.o
[378/509] Building CXX object src/wallet/CMakeFiles/wallet.dir/wallet.cpp.o
[379/509] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpcwallet.cpp.o
ninja: build stopped: cannot make progress due to previous errors.
Build build-clang failed with exit code 1

Tail of the build log:

[321/507] Building CXX object src/CMakeFiles/bitcoinconsensus.dir/arith_uint256.cpp.o
[322/507] Building CXX object src/CMakeFiles/util.dir/rpc/request.cpp.o
[323/507] Linking C static library src/secp256k1/libsecp256k1.a
[324/507] Linking C executable src/secp256k1/ecmult-bench
[325/507] Linking C executable src/secp256k1/internal-bench
[326/507] Linking C executable src/secp256k1/sign-bench
[327/507] Linking C executable src/secp256k1/verify-bench
[328/507] Building CXX object src/CMakeFiles/util.dir/blockdb.cpp.o
[329/507] Linking C executable src/secp256k1/recover-bench
[330/507] Building CXX object src/CMakeFiles/bitcoinconsensus.dir/uint256.cpp.o
[331/507] Building CXX object src/CMakeFiles/bitcoinconsensus.dir/hash.cpp.o
[332/507] Building CXX object src/CMakeFiles/util.dir/util/error.cpp.o
[333/507] Building CXX object src/CMakeFiles/bitcoinconsensus.dir/util/strencodings.cpp.o
[334/507] Building CXX object src/CMakeFiles/util.dir/util/settings.cpp.o
[335/507] Building CXX object src/CMakeFiles/util.dir/util/message.cpp.o
[336/507] Building CXX object src/CMakeFiles/bitcoinconsensus.dir/pubkey.cpp.o
[337/507] Building CXX object src/CMakeFiles/bitcoin-tx.dir/bitcoin-tx.cpp.o
[338/507] Building CXX object src/CMakeFiles/bitcoinconsensus.dir/consensus/tx_check.cpp.o
[339/507] Building CXX object src/CMakeFiles/bitcoinconsensus.dir/primitives/transaction.cpp.o
[340/507] Building CXX object src/test/CMakeFiles/testutil.dir/util/str.cpp.o
[341/507] Building CXX object src/test/CMakeFiles/testutil.dir/util/logging.cpp.o
[342/507] Building CXX object src/wallet/CMakeFiles/wallet.dir/context.cpp.o
[343/507] Building CXX object src/test/CMakeFiles/testutil.dir/util/transaction_utils.cpp.o
[344/507] Building CXX object src/CMakeFiles/util.dir/util/time.cpp.o
[345/507] Building CXX object src/test/CMakeFiles/testutil.dir/util/blockfilter.cpp.o
[346/507] Building CXX object src/wallet/CMakeFiles/wallet.dir/coinselection.cpp.o
[347/507] Building CXX object src/wallet/CMakeFiles/wallet.dir/coincontrol.cpp.o
[348/507] Building CXX object src/wallet/CMakeFiles/wallet.dir/db.cpp.o
[349/507] Building CXX object src/CMakeFiles/util.dir/util/system.cpp.o
[350/507] Linking CXX static library src/libutil.a
[351/507] Linking CXX static library src/librpcclient.a
[352/507] Building CXX object src/test/CMakeFiles/testutil.dir/util/mining.cpp.o
[353/507] Linking CXX static library src/libbitcoinconsensus.a
[354/507] Building CXX object src/test/CMakeFiles/testutil.dir/util/net.cpp.o
[355/507] Building CXX object src/wallet/CMakeFiles/wallet.dir/bdb.cpp.o
[356/507] Building CXX object src/test/CMakeFiles/testutil.dir/util/wallet.cpp.o
[357/507] Building CXX object src/wallet/CMakeFiles/wallet.dir/crypter.cpp.o
[358/507] Building CXX object src/zmq/CMakeFiles/zmq.dir/zmqabstractnotifier.cpp.o
[359/507] Building CXX object src/test/CMakeFiles/testutil.dir/util/setup_common.cpp.o
[360/507] Building CXX object src/wallet/CMakeFiles/wallet-tool.dir/wallettool.cpp.o
[361/507] Building CXX object src/zmq/CMakeFiles/zmq.dir/zmqnotificationinterface.cpp.o
[362/507] Building CXX object src/wallet/CMakeFiles/wallet.dir/fees.cpp.o
[363/507] Building CXX object src/zmq/CMakeFiles/zmq.dir/zmqpublishnotifier.cpp.o
[364/507] Building CXX object src/wallet/CMakeFiles/wallet.dir/load.cpp.o
[365/507] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/dns.cpp.o
[366/507] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletutil.cpp.o
[367/507] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/db.cpp.o
[368/507] Building CXX object src/wallet/CMakeFiles/wallet.dir/__/interfaces/wallet.cpp.o
[369/507] Building CXX object src/wallet/CMakeFiles/wallet.dir/salvage.cpp.o
[370/507] Building CXX object src/zmq/CMakeFiles/zmq.dir/zmqrpc.cpp.o
[371/507] Linking CXX static library src/zmq/libzmq.a
[372/507] Building CXX object src/seeder/CMakeFiles/bitcoin-seeder.dir/main.cpp.o
[373/507] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/bitcoin.cpp.o
[374/507] Building CXX object src/wallet/CMakeFiles/wallet.dir/scriptpubkeyman.cpp.o
[375/507] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletdb.cpp.o
[376/507] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpcdump.cpp.o
[377/507] Building CXX object src/wallet/CMakeFiles/wallet.dir/wallet.cpp.o
[378/507] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpcwallet.cpp.o
ninja: build stopped: cannot make progress due to previous errors.
Build build-clang-tidy failed with exit code 1
majcosta requested changes to this revision.Aug 27 2021, 20:54
majcosta added a subscriber: majcosta.

tests failing

This revision now requires changes to proceed.Aug 27 2021, 20:54
PiRK planned changes to this revision.Aug 28 2021, 06:31

I couldn't reproduce the issue with clang version 13. But let's try something: use value-initialization instead of aggregate initialization (whatever that means https://stackoverflow.com/questions/56745324/temporary-of-type-a-has-protected-destructor-but-its-type-is-b)

Two backports in one go :)
I updated the description to mention PR19428.

This revision is now accepted and ready to land.Aug 30 2021, 09:10
This revision was automatically updated to reflect the committed changes.