Skip to content

Commit

Permalink
Merge bitcoin/bitcoin#29042: doc: Clarify C++20 comments
Browse files Browse the repository at this point in the history
fa87f8f doc: Clarify C++20 comments (MarcoFalke)

Pull request description:

  Turns out "class template argument deduction for aggregates" is one of the few things implemented only in recent compilers, see https://en.cppreference.com/w/cpp/compiler_support/20

  So clarify the comments.

ACKs for top commit:
  hebasto:
    ACK fa87f8f, I verified the code with clang-{16,17}.

Tree-SHA512: f6d20f946cb6f8e34db224e074ed8f9dfa598377c066d1b58a8feb9e64d007444f1e2c0399e91a3e282fd5d59f90e0d7df90aa3956824d96bc78070ee12f603c
  • Loading branch information
fanquake committed Jan 5, 2024
2 parents c80f57b + fa87f8f commit 7c248b9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/test/fuzz/fuzz.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2009-2022 The Bitcoin Core developers
// Copyright (c) 2009-present The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

Expand Down Expand Up @@ -71,7 +71,7 @@ auto& FuzzTargets()

void FuzzFrameworkRegisterTarget(std::string_view name, TypeTestOneInput target, FuzzTargetOptions opts)
{
const auto it_ins{FuzzTargets().try_emplace(name, FuzzTarget /* temporary can be dropped in C++20 */ {std::move(target), std::move(opts)})};
const auto it_ins{FuzzTargets().try_emplace(name, FuzzTarget /* temporary can be dropped after clang-16 */ {std::move(target), std::move(opts)})};
Assert(it_ins.second);
}

Expand Down
4 changes: 2 additions & 2 deletions src/util/overloaded.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2021 The Bitcoin Core developers
// Copyright (c) 2021-present The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

Expand All @@ -15,7 +15,7 @@ namespace util {
//! https://en.cppreference.com/w/cpp/utility/variant/visit#Example
template<class... Ts> struct Overloaded : Ts... { using Ts::operator()...; };

//! Explicit deduction guide (not needed as of C++20)
//! Explicit deduction guide (not needed after clang-17)
template<class... Ts> Overloaded(Ts...) -> Overloaded<Ts...>;
} // namespace util

Expand Down
1 change: 1 addition & 0 deletions src/util/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#ifndef BITCOIN_UTIL_TYPES_H
#define BITCOIN_UTIL_TYPES_H

// Not needed after C++23 (DR, https://cplusplus.github.io/CWG/issues/2518.html)
template <class>
inline constexpr bool ALWAYS_FALSE{false};

Expand Down

0 comments on commit 7c248b9

Please sign in to comment.