New warnings currently emitted by the shortly-to-be-released GCC 13.
This is building master (eebc24bfc6d2d809952e27c7fe269452f319455f), using GCC gcc (GCC) 13.0.0 20230115 (Red Hat 13.0.0-0)
:
0external_signer.cpp: In static member function ‘static bool ExternalSigner::Enumerate(const std::string&, std::vector<ExternalSigner>&, std::string)’:
1external_signer.cpp:33:25: warning: possibly dangling reference to a temporary [-Wdangling-reference]
2 33 | const UniValue& error = find_value(signer, "error");
3 | ^~~~~
4external_signer.cpp:33:43: note: the temporary was destroyed at the end of the full expression ‘find_value((* & signer), std::__cxx11::basic_string<char>(((const char*)"error"), std::allocator<char>()))’
5 33 | const UniValue& error = find_value(signer, "error");
6 | ~~~~~~~~~~^~~~~~~~~~~~~~~~~
7external_signer.cpp:41:25: warning: possibly dangling reference to a temporary [-Wdangling-reference]
8 41 | const UniValue& fingerprint = find_value(signer, "fingerprint");
9 | ^~~~~~~~~~~
10external_signer.cpp:41:49: note: the temporary was destroyed at the end of the full expression ‘find_value((* & signer), std::__cxx11::basic_string<char>(((const char*)"fingerprint"), std::allocator<char>()))’
11 41 | const UniValue& fingerprint = find_value(signer, "fingerprint");
12 | ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
13external_signer.cpp:53:25: warning: possibly dangling reference to a temporary [-Wdangling-reference]
14 53 | const UniValue& model_field = find_value(signer, "model");
15 | ^~~~~~~~~~~
16external_signer.cpp:53:49: note: the temporary was destroyed at the end of the full expression ‘find_value((* & signer), std::__cxx11::basic_string<char>(((const char*)"model"), std::allocator<char>()))’
17 53 | const UniValue& model_field = find_value(signer, "model");
18 | ~~~~~~~~~~^~~~~~~~~~~~~~~~~
0rpc/rawtransaction_util.cpp: In function ‘CMutableTransaction ConstructTransaction(const UniValue&, const UniValue&, const UniValue&, std::optional<bool>)’:
1rpc/rawtransaction_util.cpp:55:25: warning: possibly dangling reference to a temporary [-Wdangling-reference]
2 55 | const UniValue& vout_v = find_value(o, "vout");
3 | ^~~~~~
4rpc/rawtransaction_util.cpp:55:44: note: the temporary was destroyed at the end of the full expression ‘find_value((* & o), std::__cxx11::basic_string<char>(((const char*)"vout"), std::allocator<char>()))’
5 55 | const UniValue& vout_v = find_value(o, "vout");
6 | ~~~~~~~~~~^~~~~~~~~~~
7rpc/rawtransaction_util.cpp:73:25: warning: possibly dangling reference to a temporary [-Wdangling-reference]
8 73 | const UniValue& sequenceObj = find_value(o, "sequence");
9 | ^~~~~~~~~~~
10rpc/rawtransaction_util.cpp:73:49: note: the temporary was destroyed at the end of the full expression ‘find_value((* & o), std::__cxx11::basic_string<char>(((const char*)"sequence"), std::allocator<char>()))’
11 73 | const UniValue& sequenceObj = find_value(o, "sequence");
12 | ~~~~~~~~~~^~~~~~~~~~~~~~~
0bitcoin-cli.cpp: In function ‘UniValue ConnectAndCallRPC(BaseRequestHandler*, const std::string&, const std::vector<std::__cxx11::basic_string<char> >&, const std::optional<std::__cxx11::basic_string<char> >&)’:
1bitcoin-cli.cpp:853:33: warning: possibly dangling reference to a temporary [-Wdangling-reference]
2 853 | const UniValue& error = find_value(response, "error");
3 | ^~~~~
4bitcoin-cli.cpp:853:51: note: the temporary was destroyed at the end of the full expression ‘find_value(response, std::__cxx11::basic_string<char>(((const char*)"error"), std::allocator<char>()))’
5 853 | const UniValue& error = find_value(response, "error");
6 | ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
7bitcoin-cli.cpp: In function ‘void ParseError(const UniValue&, std::string&, int&)’:
8bitcoin-cli.cpp:881:25: warning: possibly dangling reference to a temporary [-Wdangling-reference]
9 881 | const UniValue& err_code = find_value(error, "code");
10 | ^~~~~~~~
11bitcoin-cli.cpp:881:46: note: the temporary was destroyed at the end of the full expression ‘find_value((* & error), std::__cxx11::basic_string<char>(((const char*)"code"), std::allocator<char>()))’
12 881 | const UniValue& err_code = find_value(error, "code");
13 | ~~~~~~~~~~^~~~~~~~~~~~~~~
14bitcoin-cli.cpp:882:25: warning: possibly dangling reference to a temporary [-Wdangling-reference]
15 882 | const UniValue& err_msg = find_value(error, "message");
16 | ^~~~~~~
17bitcoin-cli.cpp:882:45: note: the temporary was destroyed at the end of the full expression ‘find_value((* & error), std::__cxx11::basic_string<char>(((const char*)"message"), std::allocator<char>()))’
18 882 | const UniValue& err_msg = find_value(error, "message");
19 | ~~~~~~~~~~^~~~~~~~~~~~~~~~~~
20bitcoin-cli.cpp: In function ‘void GetWalletBalances(UniValue&)’:
21bitcoin-cli.cpp:909:21: warning: possibly dangling reference to a temporary [-Wdangling-reference]
22 909 | const UniValue& wallets = find_value(listwallets, "result");
23 | ^~~~~~~
24bitcoin-cli.cpp:909:41: note: the temporary was destroyed at the end of the full expression ‘find_value(listwallets, std::__cxx11::basic_string<char>(((const char*)"result"), std::allocator<char>()))’
25 909 | const UniValue& wallets = find_value(listwallets, "result");
26 | ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
27bitcoin-cli.cpp:916:25: warning: possibly dangling reference to a temporary [-Wdangling-reference]
28 916 | const UniValue& balance = find_value(getbalances, "result")["mine"]["trusted"];
29 | ^~~~~~~
30bitcoin-cli.cpp:916:86: note: the temporary was destroyed at the end of the full expression ‘(&(& find_value(getbalances, std::__cxx11::basic_string<char>(((const char*)"result"), std::allocator<char>())))->UniValue::operator[](std::__cxx11::basic_string<char>(((const char*)"mine"), std::allocator<char>())))->UniValue::operator[](std::__cxx11::basic_string<char>(((const char*)"trusted"), std::allocator<char>()))’
31 916 | const UniValue& balance = find_value(getbalances, "result")["mine"]["trusted"];
32 | ^
33bitcoin-cli.cpp: In function ‘int CommandLineRPC(int, char**)’:
34bitcoin-cli.cpp:1163:29: warning: possibly dangling reference to a temporary [-Wdangling-reference]
35 1163 | const UniValue& error{find_value(getnewaddress, "error")};
36 | ^~~~~
37bitcoin-cli.cpp:1163:45: note: the temporary was destroyed at the end of the full expression ‘find_value(getnewaddress, std::__cxx11::basic_string<char>(((const char*)"error"), std::allocator<char>()))’
38 1163 | const UniValue& error{find_value(getnewaddress, "error")};
39 | ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
40bitcoin-cli.cpp:1188:29: warning: possibly dangling reference to a temporary [-Wdangling-reference]
41 1188 | const UniValue& error = find_value(reply, "error");
42 | ^~~~~
43bitcoin-cli.cpp:1188:47: note: the temporary was destroyed at the end of the full expression ‘find_value(reply, std::__cxx11::basic_string<char>(((const char*)"error"), std::allocator<char>()))’
44 1188 | const UniValue& error = find_value(reply, "error");
45 | ~~~~~~~~~~^~~~~~~~~~~~~~~~
0rpc/mining.cpp: In lambda function:
1rpc/mining.cpp:606:25: warning: possibly dangling reference to a temporary [-Wdangling-reference]
2 606 | const UniValue& modeval = find_value(oparam, "mode");
3 | ^~~~~~~
4rpc/mining.cpp:606:45: note: the temporary was destroyed at the end of the full expression ‘find_value((* & oparam), std::__cxx11::basic_string<char>(((const char*)"mode"), std::allocator<char>()))’
5 606 | const UniValue& modeval = find_value(oparam, "mode");
6 | ~~~~~~~~~~^~~~~~~~~~~~~~~~
7rpc/mining.cpp:619:29: warning: possibly dangling reference to a temporary [-Wdangling-reference]
8 619 | const UniValue& dataval = find_value(oparam, "data");
9 | ^~~~~~~
10rpc/mining.cpp:619:49: note: the temporary was destroyed at the end of the full expression ‘find_value((* & oparam), std::__cxx11::basic_string<char>(((const char*)"data"), std::allocator<char>()))’
11 619 | const UniValue& dataval = find_value(oparam, "data");
12 | ~~~~~~~~~~^~~~~~~~~~~~~~~~
13rpc/mining.cpp:646:25: warning: possibly dangling reference to a temporary [-Wdangling-reference]
14 646 | const UniValue& aClientRules = find_value(oparam, "rules");
15 | ^~~~~~~~~~~~
16rpc/mining.cpp:646:50: note: the temporary was destroyed at the end of the full expression ‘find_value((* & oparam), std::__cxx11::basic_string<char>(((const char*)"rules"), std::allocator<char>()))’
17 646 | const UniValue& aClientRules = find_value(oparam, "rules");
18 | ~~~~~~~~~~^~~~~~~~~~~~~~~~~
0test/interfaces_tests.cpp: In member function ‘void interfaces_tests::findCommonAncestor::test_method()’:
1test/interfaces_tests.cpp:101:19: warning: possibly dangling reference to a temporary [-Wdangling-reference]
2 101 | const CChain& active = WITH_LOCK(Assert(m_node.chainman)->GetMutex(), return Assert(m_node.chainman)->ActiveChain());
3 | ^~~~~~
4In file included from ./util/system.h:21,
5 from ./test/util/setup_common.h:19,
6 from test/interfaces_tests.cpp:9:
7./sync.h:302:96: note: the temporary was destroyed at the end of the full expression ‘<lambda closure object>interfaces_tests::findCommonAncestor::test_method()::<lambda()>{((interfaces_tests::findCommonAncestor*)this)}.interfaces_tests::findCommonAncestor::test_method()::<lambda()>()’
8 302 | #define WITH_LOCK(cs, code) (MaybeCheckNotHeld(cs), [&]() -> decltype(auto) { LOCK(cs); code; }())
9 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
10test/interfaces_tests.cpp:101:28: note: in expansion of macro ‘WITH_LOCK’
11 101 | const CChain& active = WITH_LOCK(Assert(m_node.chainman)->GetMutex(), return Assert(m_node.chainman)->ActiveChain());
12 | ^~~~~~~~~
0test/system_tests.cpp: In member function ‘void system_tests::run_command::test_method()’:
1test/system_tests.cpp:48:25: warning: possibly dangling reference to a temporary [-Wdangling-reference]
2 48 | const UniValue& success = find_value(result, "success");
3 | ^~~~~~~
4test/system_tests.cpp:48:45: note: the temporary was destroyed at the end of the full expression ‘find_value(result, std::__cxx11::basic_string<char>(((const char*)"success"), std::allocator<char>()))’
5 48 | const UniValue& success = find_value(result, "success");
6 | ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
7test/system_tests.cpp:96:25: warning: possibly dangling reference to a temporary [-Wdangling-reference]
8 96 | const UniValue& success = find_value(result, "success");
9 | ^~~~~~~
10test/system_tests.cpp:96:45: note: the temporary was destroyed at the end of the full expression ‘find_value(result, std::__cxx11::basic_string<char>(((const char*)"success"), std::allocator<char>()))’
11 96 | const UniValue& success = find_value(result, "success");
12 | ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~