diff --git a/arcanist/linter/CppCheckLinter.php b/arcanist/linter/CppCheckLinter.php
--- a/arcanist/linter/CppCheckLinter.php
+++ b/arcanist/linter/CppCheckLinter.php
@@ -116,7 +116,7 @@
'-j2',
'--enable=all',
'--language=c++',
- '--std=c++14',
+ '--std=c++17',
);
const CPPCHECK_DEFINITIONS = array(
diff --git a/doc/build-osx.md b/doc/build-osx.md
--- a/doc/build-osx.md
+++ b/doc/build-osx.md
@@ -32,7 +32,7 @@
Build Bitcoin ABC
-----------------
-Before you start building, please make sure that your compiler supports C++14.
+Before you start building, please make sure that your compiler supports C++17.
1. Clone the Bitcoin ABC source code and cd into `bitcoin-abc`
diff --git a/doc/build-unix.md b/doc/build-unix.md
--- a/doc/build-unix.md
+++ b/doc/build-unix.md
@@ -5,7 +5,7 @@
To Build
---------------------
-Before you start building, please make sure that your compiler supports C++14.
+Before you start building, please make sure that your compiler supports C++17.
It is recommended to create a build directory to build out-of-tree.
diff --git a/doc/build-windows.md b/doc/build-windows.md
--- a/doc/build-windows.md
+++ b/doc/build-windows.md
@@ -15,7 +15,7 @@
* On Windows, using a POSIX compatibility layer application such as [cygwin](http://www.cygwin.com/) or [msys2](http://www.msys2.org/).
* On Windows, using a native compiler tool chain such as [Visual Studio](https://www.visualstudio.com).
-In any case please make sure that the compiler supports C++14.
+In any case please make sure that the compiler supports C++17.
Installing Windows Subsystem for Linux
---------------------------------------
diff --git a/doc/dependencies.md b/doc/dependencies.md
--- a/doc/dependencies.md
+++ b/doc/dependencies.md
@@ -7,12 +7,12 @@
| --- | --- | --- | --- | --- | --- |
| Berkeley DB | [5.3.28](http://www.oracle.com/technetwork/database/database-technologies/berkeleydb/downloads/index.html) | 5.3 | No | | |
| Boost | [1.70.0](https://www.boost.org/users/download/) | 1.59.0 | No | | |
-| Clang | | [3.4](https://releases.llvm.org/download.html) (C++14 support) | | | |
+| Clang | | [5](https://releases.llvm.org/download.html) (C++17 support) | | | |
| CMake | | [3.16](https://cmake.org/download/) | | | |
| Expat | [2.2.7](https://libexpat.github.io/) | | No | Yes | |
| fontconfig | [2.12.6](https://www.freedesktop.org/software/fontconfig/release/) | | No | Yes | |
| FreeType | [2.7.1](http://download.savannah.gnu.org/releases/freetype) | | No | | |
-| GCC | | [5.0](https://gcc.gnu.org/) (C++14 support) | | | |
+| GCC | | [7](https://gcc.gnu.org/) (C++17 support) | | | |
| HarfBuzz-NG | | | | | |
| jemalloc | [5.2.1](https://github.com/jemalloc/jemalloc/releases) | 3.6.0 | | | |
| libevent | [2.1.11-stable](https://github.com/libevent/libevent/releases) | 2.0.22 | No | | |
diff --git a/doc/release-notes.md b/doc/release-notes.md
--- a/doc/release-notes.md
+++ b/doc/release-notes.md
@@ -5,3 +5,5 @@
This release includes the following features and fixes:
+
+- Code updated to conform to the C++17 standard.
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -2,7 +2,8 @@
project(bitcoind)
-set(CMAKE_CXX_STANDARD 14)
+set(CMAKE_CXX_STANDARD 17)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Default visibility is hidden on all targets.
set(CMAKE_C_VISIBILITY_PRESET hidden)
diff --git a/src/compat/assumptions.h b/src/compat/assumptions.h
--- a/src/compat/assumptions.h
+++ b/src/compat/assumptions.h
@@ -20,7 +20,7 @@
#error "Bitcoin cannot be compiled without assertions."
#endif
-// Assumption: We assume a C++14 (ISO/IEC 14882:2014) compiler (minimum
+// Assumption: We assume a C++17 (ISO/IEC 14882:2017) compiler (minimum
// requirement).
// Example(s): We use std::make_unique() through the codebase.
// Note: MSVC does not report the expected __cplusplus value due to
@@ -29,7 +29,7 @@
// N3936* ยง16.8 [cpp.predefined]/p1::
// "The name __cplusplus is defined to the value 201402L when compiling a C++
// translation unit."
-static_assert(__cplusplus >= 201402L, "C++14 standard assumed");
+static_assert(__cplusplus >= 201703L, "C++17 standard assumed");
#endif
// Assumption: We assume the floating-point types to fulfill the requirements of
diff --git a/src/span.h b/src/span.h
--- a/src/span.h
+++ b/src/span.h
@@ -25,6 +25,28 @@
constexpr Span(C *data, C *end) noexcept
: m_data(data), m_size(end - data) {}
+ /** Implicit conversion of spans between compatible types.
+ *
+ * Specifically, if a pointer to an array of type O can be implicitly
+ * converted to a pointer to an array of type C, then permit implicit
+ * conversion of Span to Span. This matches the behavior of the
+ * corresponding C++20 std::span constructor.
+ *
+ * For example this means that a Span can be converted into a Span.
+ */
+ template ::value, int>::type = 0>
+ constexpr Span(const Span &other) noexcept
+ : m_data(other.m_data), m_size(other.m_size) {}
+
+ /** Default copy constructor. */
+ constexpr Span(const Span &) noexcept = default;
+
+ /** Default assignment operator. */
+ Span &operator=(const Span &other) noexcept = default;
+
constexpr C *data() const noexcept { return m_data; }
constexpr C *begin() const noexcept { return m_data; }
constexpr C *end() const noexcept { return m_data + m_size; }
@@ -69,6 +91,8 @@
friend constexpr bool operator>=(const Span &a, const Span &b) noexcept {
return !(a < b);
}
+
+ template friend class Span;
};
/** Create a span to a container exposing data() and size().