diff --git a/.clang-format b/.clang-format
index 9efb854d..7f71afcc 100644
--- a/.clang-format
+++ b/.clang-format
@@ -1,6 +1,6 @@
---
Language: Cpp
-Standard: c++14
+Standard: c++17
# Note that we cannot use IncludeIsMainRegex functionality, because it
# does not support includes in angle brackets (<>)
diff --git a/.clang-tidy b/.clang-tidy
index 3488457a..67b230ed 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -28,13 +28,12 @@ Checks: >-
-modernize-concat-nested-namespaces,
-modernize-use-nodiscard,
-modernize-use-default-member-init,
- -modernize-type-traits,# we need to support C++14,
-modernize-deprecated-headers,
,# There's a lot of these and most of them are probably not useful,
-modernize-pass-by-value,
performance-*,
- performance-enum-size,
+ -performance-enum-size,
portability-*,
diff --git a/.github/workflows/linux-meson-builds.yml b/.github/workflows/linux-meson-builds.yml
index e48dea9d..1536e4fc 100644
--- a/.github/workflows/linux-meson-builds.yml
+++ b/.github/workflows/linux-meson-builds.yml
@@ -4,7 +4,7 @@ on: [push, pull_request]
jobs:
build:
- name: meson ${{matrix.cxx}}, C++${{matrix.std}}, ${{matrix.build_type}}
+ name: meson ${{matrix.cxx}}, ${{matrix.build_type}}
runs-on: ubuntu-22.04
strategy:
fail-fast: false
@@ -13,7 +13,6 @@ jobs:
- g++-11
- clang++-11
build_type: [debug, release]
- std: [14, 17]
include:
- cxx: clang++-11
other_pkgs: clang-11
@@ -29,7 +28,7 @@ jobs:
- name: Configure
env:
CXX: ${{matrix.cxx}}
- CXXFLAGS: -std=c++${{matrix.std}} ${{matrix.cxxflags}}
+ CXXFLAGS: -std=c++17 ${{matrix.cxxflags}}
# Note: $GITHUB_WORKSPACE is distinct from ${{runner.workspace}}.
# This is important
run: |
diff --git a/.github/workflows/linux-other-builds.yml b/.github/workflows/linux-other-builds.yml
index 6095f24b..5b2d6563 100644
--- a/.github/workflows/linux-other-builds.yml
+++ b/.github/workflows/linux-other-builds.yml
@@ -7,7 +7,7 @@ on: [push, pull_request]
jobs:
build:
- name: ${{matrix.build_description}}, ${{matrix.cxx}}, C++${{matrix.std}} ${{matrix.build_type}}
+ name: ${{matrix.build_description}}, ${{matrix.cxx}}, ${{matrix.build_type}}
runs-on: ubuntu-22.04
strategy:
fail-fast: false
@@ -20,7 +20,6 @@ jobs:
- cxx: clang++-14
build_description: Surrogates build
build_type: Debug
- std: 14
other_pkgs: clang-14
cmake_configurations: -DCATCH_BUILD_SURROGATES=ON
@@ -28,13 +27,11 @@ jobs:
- cxx: g++-11
build_description: Extras + Examples
build_type: Debug
- std: 14
other_pkgs: g++-11
cmake_configurations: -DCATCH_BUILD_EXTRA_TESTS=ON -DCATCH_BUILD_EXAMPLES=ON -DCATCH_ENABLE_CMAKE_HELPER_TESTS=ON
- cxx: g++-11
build_description: Extras + Examples
build_type: Release
- std: 14
other_pkgs: g++-11
cmake_configurations: -DCATCH_BUILD_EXTRA_TESTS=ON -DCATCH_BUILD_EXAMPLES=ON -DCATCH_ENABLE_CMAKE_HELPER_TESTS=ON
@@ -42,29 +39,18 @@ jobs:
- cxx: clang++-14
build_description: Extras + Examples
build_type: Debug
- std: 17
other_pkgs: clang-14
cmake_configurations: -DCATCH_BUILD_EXTRA_TESTS=ON -DCATCH_BUILD_EXAMPLES=ON -DCATCH_ENABLE_CMAKE_HELPER_TESTS=ON
- cxx: clang++-14
build_description: Extras + Examples
build_type: Release
- std: 17
other_pkgs: clang-14
cmake_configurations: -DCATCH_BUILD_EXTRA_TESTS=ON -DCATCH_BUILD_EXAMPLES=ON -DCATCH_ENABLE_CMAKE_HELPER_TESTS=ON
- # Configure tests with Clang-14
- - cxx: clang++-14
- build_description: CMake configuration tests
- build_type: Debug
- std: 14
- other_pkgs: clang-14
- cmake_configurations: -DCATCH_ENABLE_CONFIGURE_TESTS=ON
-
# Valgrind test Clang-14
# - cxx: clang++-14
# build_description: Valgrind tests
# build_type: Debug
- # std: 14
# other_pkgs: clang-14 valgrind
# cmake_configurations: -DMEMORYCHECK_COMMAND=`which valgrind` -DMEMORYCHECK_COMMAND_OPTIONS="-q --track-origins=yes --leak-check=full --num-callers=50 --show-leak-kinds=definite --error-exitcode=1"
# other_ctest_args: -T memcheck -LE uses-python
@@ -83,7 +69,6 @@ jobs:
cmake --preset basic-tests -GNinja \
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
-DCMAKE_CXX_COMPILER=${{matrix.cxx}} \
- -DCMAKE_CXX_STANDARD=${{matrix.std}} \
${{matrix.cmake_configurations}}
- name: Build
@@ -116,7 +101,6 @@ jobs:
-DCMAKE_CXX_COMPILER_LAUNCHER=/usr/bin/true \
-DCMAKE_CXX_COMPILER=clang++-15 \
-DCMAKE_CXX_LINK_EXECUTABLE=/usr/bin/true \
- -DCMAKE_CXX_STANDARD=17 \
-DCMAKE_RANLIB=/usr/bin/true \
-DCATCH_BUILD_EXAMPLES=ON \
-DCATCH_ENABLE_CMAKE_HELPER_TESTS=ON
diff --git a/.github/workflows/linux-simple-builds.yml b/.github/workflows/linux-simple-builds.yml
index 15db5cf7..1a92371e 100644
--- a/.github/workflows/linux-simple-builds.yml
+++ b/.github/workflows/linux-simple-builds.yml
@@ -14,7 +14,6 @@ jobs:
- g++-10
- g++-11
- g++-12
- - clang++-6.0
- clang++-7
- clang++-8
- clang++-9
@@ -24,7 +23,7 @@ jobs:
- clang++-13
- clang++-14
build_type: [Debug, Release]
- std: [14]
+ std: [17]
include:
- cxx: g++-9
other_pkgs: g++-9
@@ -34,8 +33,6 @@ jobs:
other_pkgs: g++-11
- cxx: g++-12
other_pkgs: g++-12
- - cxx: clang++-6.0
- other_pkgs: clang-6.0
- cxx: clang++-7
other_pkgs: clang-7
- cxx: clang++-8
@@ -52,15 +49,6 @@ jobs:
other_pkgs: clang-13
- cxx: clang++-14
other_pkgs: clang-14
- # Clang 14 + C++17
- - cxx: clang++-14
- build_type: Debug
- std: 17
- other_pkgs: clang-14
- - cxx: clang++-14
- build_type: Release
- std: 17
- other_pkgs: clang-14
- cxx: clang++-14
build_type: Debug
std: 20
diff --git a/.github/workflows/mac-builds.yml b/.github/workflows/mac-builds.yml
index 6ac4c2a9..1f542953 100644
--- a/.github/workflows/mac-builds.yml
+++ b/.github/workflows/mac-builds.yml
@@ -12,7 +12,6 @@ jobs:
matrix:
image: [macos-13, macos-14, macos-15]
build_type: [Debug, Release]
- std: [14, 17]
steps:
- uses: actions/checkout@v4
@@ -21,7 +20,6 @@ jobs:
run: |
cmake --preset basic-tests -GNinja \
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
- -DCMAKE_CXX_STANDARD=${{matrix.std}} \
-DCATCH_BUILD_EXAMPLES=ON \
-DCATCH_BUILD_EXTRA_TESTS=ON
diff --git a/.github/workflows/windows-simple-builds.yml b/.github/workflows/windows-simple-builds.yml
index e6d852b6..107ac84a 100644
--- a/.github/workflows/windows-simple-builds.yml
+++ b/.github/workflows/windows-simple-builds.yml
@@ -4,7 +4,7 @@ on: [push, pull_request]
jobs:
build:
- name: ${{matrix.os}}, ${{matrix.std}}, ${{matrix.build_type}}, ${{matrix.platform}}
+ name: ${{matrix.os}}, ${{matrix.build_type}}, ${{matrix.platform}}
runs-on: ${{matrix.os}}
strategy:
fail-fast: false
@@ -12,7 +12,6 @@ jobs:
os: [windows-2022, windows-2025]
platform: [Win32, x64]
build_type: [Debug, Release]
- std: [14, 17]
steps:
- uses: actions/checkout@v4
@@ -20,7 +19,6 @@ jobs:
run: |
cmake --preset all-tests `
-A ${{matrix.platform}} `
- -DCMAKE_CXX_STANDARD=${{matrix.std}} `
- name: Build tests
run: cmake --build build --config ${{matrix.build_type}} --parallel %NUMBER_OF_PROCESSORS%
diff --git a/BUILD.bazel b/BUILD.bazel
index eb484e40..203ca90a 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -27,11 +27,6 @@ expand_template(
"#cmakedefine CATCH_CONFIG_COLOUR_WIN32": "",
"#cmakedefine CATCH_CONFIG_COUNTER": "",
"#cmakedefine CATCH_CONFIG_CPP11_TO_STRING": "",
- "#cmakedefine CATCH_CONFIG_CPP17_BYTE": "",
- "#cmakedefine CATCH_CONFIG_CPP17_OPTIONAL": "",
- "#cmakedefine CATCH_CONFIG_CPP17_STRING_VIEW": "",
- "#cmakedefine CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS": "",
- "#cmakedefine CATCH_CONFIG_CPP17_VARIANT": "",
"#cmakedefine CATCH_CONFIG_DEPRECATION_ANNOTATIONS": "",
"#cmakedefine CATCH_CONFIG_DISABLE_EXCEPTIONS_CUSTOM_HANDLER": "",
"#cmakedefine CATCH_CONFIG_DISABLE_EXCEPTIONS": "",
@@ -51,11 +46,6 @@ expand_template(
"#cmakedefine CATCH_CONFIG_NO_COLOUR_WIN32": "",
"#cmakedefine CATCH_CONFIG_NO_COUNTER": "",
"#cmakedefine CATCH_CONFIG_NO_CPP11_TO_STRING": "",
- "#cmakedefine CATCH_CONFIG_NO_CPP17_BYTE": "",
- "#cmakedefine CATCH_CONFIG_NO_CPP17_OPTIONAL": "",
- "#cmakedefine CATCH_CONFIG_NO_CPP17_STRING_VIEW": "",
- "#cmakedefine CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS": "",
- "#cmakedefine CATCH_CONFIG_NO_CPP17_VARIANT": "",
"#cmakedefine CATCH_CONFIG_NO_DEPRECATION_ANNOTATIONS": "",
"#cmakedefine CATCH_CONFIG_NO_GETENV": "",
"#cmakedefine CATCH_CONFIG_NO_GLOBAL_NEXTAFTER": "",
diff --git a/CMake/CatchConfigOptions.cmake b/CMake/CatchConfigOptions.cmake
index 3621fac0..cab60324 100644
--- a/CMake/CatchConfigOptions.cmake
+++ b/CMake/CatchConfigOptions.cmake
@@ -31,11 +31,6 @@ set(_OverridableOptions
"COLOUR_WIN32"
"COUNTER"
"CPP11_TO_STRING"
- "CPP17_BYTE"
- "CPP17_OPTIONAL"
- "CPP17_STRING_VIEW"
- "CPP17_UNCAUGHT_EXCEPTIONS"
- "CPP17_VARIANT"
"GLOBAL_NEXTAFTER"
"POSIX_SIGNALS"
"USE_ASYNC"
diff --git a/CMake/catch2-with-main.pc.in b/CMake/catch2-with-main.pc.in
index eeac3e35..516ac5c4 100644
--- a/CMake/catch2-with-main.pc.in
+++ b/CMake/catch2-with-main.pc.in
@@ -3,7 +3,7 @@ libdir=${prefix}/@lib_dir@
pkg_version=@Catch2_VERSION@
Name: Catch2 with main function
-Description: A modern, C++-native test framework for C++14 and above (links in default main)
+Description: A modern, C++-native test framework for C++17 and above (links in default main)
URL: https://github.com/catchorg/Catch2
Version: ${pkg_version}
Requires: catch2 = ${pkg_version}
diff --git a/CMake/catch2.pc.in b/CMake/catch2.pc.in
index 74e22c15..40d1f003 100644
--- a/CMake/catch2.pc.in
+++ b/CMake/catch2.pc.in
@@ -4,7 +4,7 @@ includedir=${prefix}/@include_dir@
libdir=${prefix}/@lib_dir@
Name: Catch2
-Description: A modern, C++-native, test framework for C++14 and above
+Description: A modern, C++-native, test framework for C++17 and above
URL: https://github.com/catchorg/Catch2
Version: @Catch2_VERSION@
Cflags: -I${includedir}
diff --git a/docs/configuration.md b/docs/configuration.md
index f63a6d41..99dadef2 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -10,7 +10,6 @@
[Default reporter](#default-reporter)
[Bazel support](#bazel-support)
[C++11 toggles](#c11-toggles)
-[C++17 toggles](#c17-toggles)
[Other toggles](#other-toggles)
[Enabling stringification](#enabling-stringification)
[Disabling exceptions](#disabling-exceptions)
@@ -128,23 +127,6 @@ Catch's selection, by defining either `CATCH_CONFIG_CPP11_TO_STRING` or
`CATCH_CONFIG_NO_CPP11_TO_STRING`.
-## C++17 toggles
-
- CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS // Override std::uncaught_exceptions (instead of std::uncaught_exception) support detection
- CATCH_CONFIG_CPP17_STRING_VIEW // Override std::string_view support detection (Catch provides a StringMaker specialization by default)
- CATCH_CONFIG_CPP17_VARIANT // Override std::variant support detection (checked by CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER)
- CATCH_CONFIG_CPP17_OPTIONAL // Override std::optional support detection (checked by CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER)
- CATCH_CONFIG_CPP17_BYTE // Override std::byte support detection (Catch provides a StringMaker specialization by default)
-
-> `CATCH_CONFIG_CPP17_STRING_VIEW` was [introduced](https://github.com/catchorg/Catch2/issues/1376) in Catch2 2.4.1.
-
-Catch contains basic compiler/standard detection and attempts to use
-some C++17 features whenever appropriate. This automatic detection
-can be manually overridden in both directions, that is, a feature
-can be enabled by defining the macro in the table above, and disabled
-by using `_NO_` in the macro, e.g. `CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS`.
-
-
## Other toggles
CATCH_CONFIG_COUNTER // Use __COUNTER__ to generate unique names for test cases
@@ -221,8 +203,8 @@ By default, Catch does not stringify some types from the standard library. This
CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER // Provide StringMaker specialization for std::pair
CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER // Provide StringMaker specialization for std::tuple
- CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER // Provide StringMaker specialization for std::variant, std::monostate (on C++17)
- CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER // Provide StringMaker specialization for std::optional (on C++17)
+ CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER // Provide StringMaker specialization for std::variant, std::monostate
+ CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER // Provide StringMaker specialization for std::optional
CATCH_CONFIG_ENABLE_ALL_STRINGMAKERS // Defines all of the above
> `CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER` was [introduced](https://github.com/catchorg/Catch2/issues/1380) in Catch2 2.4.1.
diff --git a/docs/contributing.md b/docs/contributing.md
index d21323d9..5fa2f634 100644
--- a/docs/contributing.md
+++ b/docs/contributing.md
@@ -211,16 +211,10 @@ and so on.
### C++ standard version
-Catch2 currently targets C++14 as the minimum supported C++ version.
+Catch2 currently targets C++17 as the minimum supported C++ version.
Features from higher language versions should be used only sparingly,
when the benefits from using them outweigh the maintenance overhead.
-Example of good use of polyfilling features is our use of `conjunction`,
-where if available we use `std::conjunction` and otherwise provide our
-own implementation. The reason it is good is that the surface area for
-maintenance is quite small, and `std::conjunction` can directly use
-compiler built-ins, thus providing significant compilation benefits.
-
Example of bad use of polyfilling features would be to keep around two
sets of metaprogramming in the stringification implementation, once
using C++14 compliant TMP and once using C++17's `if constexpr`. While
diff --git a/docs/other-macros.md b/docs/other-macros.md
index 79990a6a..90cb12c9 100644
--- a/docs/other-macros.md
+++ b/docs/other-macros.md
@@ -72,8 +72,8 @@ including the Catch2 header.
Example:
```cpp
TEST_CASE("STATIC_REQUIRE showcase", "[traits]") {
- STATIC_REQUIRE( std::is_void::value );
- STATIC_REQUIRE_FALSE( std::is_void::value );
+ STATIC_REQUIRE( std::is_void_v );
+ STATIC_REQUIRE_FALSE( std::is_void_v );
}
```
@@ -86,8 +86,8 @@ becomes equivalent to `CHECK` instead of `REQUIRE`.
Example:
```cpp
TEST_CASE("STATIC_CHECK showcase", "[traits]") {
- STATIC_CHECK( std::is_void::value );
- STATIC_CHECK_FALSE( std::is_void::value );
+ STATIC_CHECK( std::is_void_v );
+ STATIC_CHECK_FALSE( std::is_void_v );
}
```
diff --git a/docs/test-cases-and-sections.md b/docs/test-cases-and-sections.md
index 14db55ae..49e19a3d 100644
--- a/docs/test-cases-and-sections.md
+++ b/docs/test-cases-and-sections.md
@@ -264,7 +264,7 @@ You can also have different arities in the _template-arg_ packs:
```cpp
TEMPLATE_PRODUCT_TEST_CASE("Product with differing arities", "[template][product]", std::tuple, (int, (int, double), (int, double, float))) {
TestType x;
- REQUIRE(std::tuple_size::value >= 1);
+ REQUIRE(std::tuple_size_v >= 1);
}
```
diff --git a/docs/why-catch.md b/docs/why-catch.md
index b7367496..5df9980a 100644
--- a/docs/why-catch.md
+++ b/docs/why-catch.md
@@ -15,7 +15,7 @@ So what does Catch2 bring to the party that differentiates it from these? Apart
## Key Features
* Quick and easy to get started. Just download two files, add them into your project and you're away.
-* No external dependencies. As long as you can compile C++14 and have the C++ standard library available.
+* No external dependencies. As long as you can compile C++17 and have the C++ standard library available.
* Write test cases as, self-registering, functions (or methods, if you prefer).
* Divide test cases into sections, each of which is run in isolation (eliminates the need for fixtures).
* Use BDD-style Given-When-Then sections as well as traditional unit test cases.
diff --git a/examples/010-TestCase.cpp b/examples/010-TestCase.cpp
index 9e5cd8cd..36a54916 100644
--- a/examples/010-TestCase.cpp
+++ b/examples/010-TestCase.cpp
@@ -27,7 +27,7 @@ TEST_CASE( "Factorials of 1 and higher are computed (pass)", "[single-file]" ) {
}
// Compile & run:
-// - g++ -std=c++14 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 010-TestCase 010-TestCase.cpp && 010-TestCase --success
+// - g++ -std=c++17 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 010-TestCase 010-TestCase.cpp && 010-TestCase --success
// - cl -EHsc -I%CATCH_SINGLE_INCLUDE% 010-TestCase.cpp && 010-TestCase --success
// Expected compact output (all assertions):
diff --git a/examples/020-TestCase-1.cpp b/examples/020-TestCase-1.cpp
index a9d87dbc..63b4c532 100644
--- a/examples/020-TestCase-1.cpp
+++ b/examples/020-TestCase-1.cpp
@@ -18,8 +18,8 @@ TEST_CASE( "1: All test cases reside in other .cpp files (empty)", "[multi-file:
// Here just to show there are two source files via option --list-tests.
// Compile & run:
-// - g++ -std=c++14 -Wall -I$(CATCH_SINGLE_INCLUDE) -c 020-TestCase-1.cpp
-// - g++ -std=c++14 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 020-TestCase TestCase-1.o 020-TestCase-2.cpp && 020-TestCase --success
+// - g++ -std=c++17 -Wall -I$(CATCH_SINGLE_INCLUDE) -c 020-TestCase-1.cpp
+// - g++ -std=c++17 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 020-TestCase TestCase-1.o 020-TestCase-2.cpp && 020-TestCase --success
//
// - cl -EHsc -I%CATCH_SINGLE_INCLUDE% -c 020-TestCase-1.cpp
// - cl -EHsc -I%CATCH_SINGLE_INCLUDE% -Fe020-TestCase.exe 020-TestCase-1.obj 020-TestCase-2.cpp && 020-TestCase --success
diff --git a/examples/030-Asn-Require-Check.cpp b/examples/030-Asn-Require-Check.cpp
index 62cd3cfc..d9c526ab 100644
--- a/examples/030-Asn-Require-Check.cpp
+++ b/examples/030-Asn-Require-Check.cpp
@@ -61,7 +61,7 @@ TEST_CASE( "Assert that something is false (continue after failure)", "[check-fa
}
// Compile & run:
-// - g++ -std=c++14 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 030-Asn-Require-Check 030-Asn-Require-Check.cpp && 030-Asn-Require-Check --success
+// - g++ -std=c++17 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 030-Asn-Require-Check 030-Asn-Require-Check.cpp && 030-Asn-Require-Check --success
// - cl -EHsc -I%CATCH_SINGLE_INCLUDE% 030-Asn-Require-Check.cpp && 030-Asn-Require-Check --success
// Expected compact output (all assertions):
diff --git a/examples/100-Fix-Section.cpp b/examples/100-Fix-Section.cpp
index 7c8d8aa8..a7a79eb4 100644
--- a/examples/100-Fix-Section.cpp
+++ b/examples/100-Fix-Section.cpp
@@ -53,7 +53,7 @@ TEST_CASE( "vectors can be sized and resized", "[vector]" ) {
}
// Compile & run:
-// - g++ -std=c++14 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 100-Fix-Section 100-Fix-Section.cpp && 100-Fix-Section --success
+// - g++ -std=c++17 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 100-Fix-Section 100-Fix-Section.cpp && 100-Fix-Section --success
// - cl -EHsc -I%CATCH_SINGLE_INCLUDE% 100-Fix-Section.cpp && 100-Fix-Section --success
// Expected compact output (all assertions):
diff --git a/examples/110-Fix-ClassFixture.cpp b/examples/110-Fix-ClassFixture.cpp
index 614c3797..5faef13f 100644
--- a/examples/110-Fix-ClassFixture.cpp
+++ b/examples/110-Fix-ClassFixture.cpp
@@ -60,11 +60,11 @@ TEST_CASE_METHOD( UniqueTestsFixture, "Create Employee/Normal", "[create]" ) {
}
// Compile & run:
-// - g++ -std=c++14 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 110-Fix-ClassFixture 110-Fix-ClassFixture.cpp && 110-Fix-ClassFixture --success
+// - g++ -std=c++17 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 110-Fix-ClassFixture 110-Fix-ClassFixture.cpp && 110-Fix-ClassFixture --success
// - cl -EHsc -I%CATCH_SINGLE_INCLUDE% 110-Fix-ClassFixture.cpp && 110-Fix-ClassFixture --success
//
// Compile with pkg-config:
-// - g++ -std=c++14 -Wall $(pkg-config catch2-with-main --cflags) -o 110-Fix-ClassFixture 110-Fix-ClassFixture.cpp $(pkg-config catch2-with-main --libs)
+// - g++ -std=c++17 -Wall $(pkg-config catch2-with-main --cflags) -o 110-Fix-ClassFixture 110-Fix-ClassFixture.cpp $(pkg-config catch2-with-main --libs)
// Expected compact output (all assertions):
//
diff --git a/examples/120-Bdd-ScenarioGivenWhenThen.cpp b/examples/120-Bdd-ScenarioGivenWhenThen.cpp
index 345d53c3..8e928b19 100644
--- a/examples/120-Bdd-ScenarioGivenWhenThen.cpp
+++ b/examples/120-Bdd-ScenarioGivenWhenThen.cpp
@@ -56,7 +56,7 @@ SCENARIO( "vectors can be sized and resized", "[vector]" ) {
}
// Compile & run:
-// - g++ -std=c++14 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 120-Bdd-ScenarioGivenWhenThen 120-Bdd-ScenarioGivenWhenThen.cpp && 120-Bdd-ScenarioGivenWhenThen --success
+// - g++ -std=c++17 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 120-Bdd-ScenarioGivenWhenThen 120-Bdd-ScenarioGivenWhenThen.cpp && 120-Bdd-ScenarioGivenWhenThen --success
// - cl -EHsc -I%CATCH_SINGLE_INCLUDE% 120-Bdd-ScenarioGivenWhenThen.cpp && 120-Bdd-ScenarioGivenWhenThen --success
// Expected compact output (all assertions):
diff --git a/examples/210-Evt-EventListeners.cpp b/examples/210-Evt-EventListeners.cpp
index d1cfdb4f..26d5c62c 100644
--- a/examples/210-Evt-EventListeners.cpp
+++ b/examples/210-Evt-EventListeners.cpp
@@ -427,7 +427,7 @@ TEST_CASE_METHOD( Fixture, "3: Testcase with class-based fixture", "[tag-C][tag-
}
// Compile & run:
-// - g++ -std=c++14 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 210-Evt-EventListeners 210-Evt-EventListeners.cpp && 210-Evt-EventListeners --success
+// - g++ -std=c++17 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 210-Evt-EventListeners 210-Evt-EventListeners.cpp && 210-Evt-EventListeners --success
// - cl -EHsc -I%CATCH_SINGLE_INCLUDE% 210-Evt-EventListeners.cpp && 210-Evt-EventListeners --success
// Expected compact output (all assertions):
diff --git a/examples/302-Gen-Table.cpp b/examples/302-Gen-Table.cpp
index 3cdb1430..4dabd9d9 100644
--- a/examples/302-Gen-Table.cpp
+++ b/examples/302-Gen-Table.cpp
@@ -22,24 +22,21 @@ struct TestSubject {
TEST_CASE("Table allows pre-computed test inputs and outputs", "[example][generator]") {
- using std::make_tuple;
// do setup here as normal
TestSubject subj;
SECTION("This section is run for each row in the table") {
- std::string test_input;
- size_t expected_output;
- std::tie( test_input, expected_output ) =
+ const auto [test_input, expected_output] =
GENERATE( table(
{ /* In this case one of the parameters to our test case is the
* expected output, but this is not required. There could be
* multiple expected values in the table, which can have any
* (fixed) number of columns.
*/
- make_tuple( "one", 3 ),
- make_tuple( "two", 3 ),
- make_tuple( "three", 5 ),
- make_tuple( "four", 4 ) } ) );
+ { "one", 3 },
+ { "two", 3 },
+ { "three", 5 },
+ { "four", 4 } } ) );
// run the test
auto result = subj.GetLength(test_input);
@@ -50,14 +47,4 @@ TEST_CASE("Table allows pre-computed test inputs and outputs", "[example][genera
} // end section
}
-/* Possible simplifications where less legacy toolchain support is needed:
- *
- * - With libstdc++6 or newer, the make_tuple() calls can be omitted
- * (technically C++17 but does not require -std in GCC/Clang). See
- * https://stackoverflow.com/questions/12436586/tuple-vector-and-initializer-list
- *
- * - In C++17 mode std::tie() and the preceding variable declarations can be
- * replaced by structured bindings: auto [test_input, expected] = GENERATE(
- * table({ ...
- */
// Compiling and running this file will result in 4 successful assertions
diff --git a/extras/catch_amalgamated.cpp b/extras/catch_amalgamated.cpp
index c85f39b3..b931d47c 100644
--- a/extras/catch_amalgamated.cpp
+++ b/extras/catch_amalgamated.cpp
@@ -84,7 +84,7 @@ namespace Catch {
std::vector samples2;
samples2.reserve(samples.size());
for (auto s : samples) {
- samples2.push_back( FDuration( s ) );
+ samples2.emplace_back( s );
}
return {
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 1e3af147..10e38dda 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -76,11 +76,9 @@ set(IMPL_HEADERS
${SOURCES_DIR}/internal/catch_config_counter.hpp
${SOURCES_DIR}/internal/catch_config_prefix_messages.hpp
${SOURCES_DIR}/internal/catch_config_static_analysis_support.hpp
- ${SOURCES_DIR}/internal/catch_config_uncaught_exceptions.hpp
${SOURCES_DIR}/internal/catch_config_wchar.hpp
${SOURCES_DIR}/internal/catch_console_colour.hpp
${SOURCES_DIR}/internal/catch_console_width.hpp
- ${SOURCES_DIR}/internal/catch_container_nonmembers.hpp
${SOURCES_DIR}/internal/catch_context.hpp
${SOURCES_DIR}/internal/catch_debug_console.hpp
${SOURCES_DIR}/internal/catch_debugger.hpp
@@ -99,7 +97,6 @@ set(IMPL_HEADERS
${SOURCES_DIR}/internal/catch_lazy_expr.hpp
${SOURCES_DIR}/internal/catch_leak_detector.hpp
${SOURCES_DIR}/internal/catch_list.hpp
- ${SOURCES_DIR}/internal/catch_logical_traits.hpp
${SOURCES_DIR}/internal/catch_message_info.hpp
${SOURCES_DIR}/internal/catch_meta.hpp
${SOURCES_DIR}/internal/catch_move_and_forward.hpp
@@ -365,8 +362,8 @@ set_target_properties(Catch2 PROPERTIES
SOVERSION ${PROJECT_VERSION}
)
-# require C++14
-target_compile_features(Catch2 PUBLIC cxx_std_14)
+# require C++17
+target_compile_features(Catch2 PUBLIC cxx_std_17)
configure_file(
"${SOURCES_DIR}/catch_user_config.hpp.in"
@@ -450,7 +447,7 @@ if(CATCH_BUILD_EXAMPLES OR CATCH_BUILD_EXTRA_TESTS)
$
)
target_compile_definitions(Catch2_buildall_interface INTERFACE CATCH_CONFIG_STATIC)
- target_compile_features(Catch2_buildall_interface INTERFACE cxx_std_14)
+ target_compile_features(Catch2_buildall_interface INTERFACE cxx_std_17)
endif()
list(APPEND CATCH_IMPL_TARGETS Catch2 Catch2WithMain)
diff --git a/src/catch2/benchmark/catch_optimizer.hpp b/src/catch2/benchmark/catch_optimizer.hpp
index 61e6571f..e701f50f 100644
--- a/src/catch2/benchmark/catch_optimizer.hpp
+++ b/src/catch2/benchmark/catch_optimizer.hpp
@@ -64,12 +64,12 @@ namespace Catch {
}
template
- inline auto invoke_deoptimized(Fn&& fn, Args&&... args) -> std::enable_if_t::value> {
+ inline auto invoke_deoptimized(Fn&& fn, Args&&... args) -> std::enable_if_t> {
deoptimize_value(CATCH_FORWARD(fn) (CATCH_FORWARD(args)...));
}
template
- inline auto invoke_deoptimized(Fn&& fn, Args&&... args) -> std::enable_if_t::value> {
+ inline auto invoke_deoptimized(Fn&& fn, Args&&... args) -> std::enable_if_t> {
CATCH_FORWARD((fn)) (CATCH_FORWARD(args)...);
}
} // namespace Benchmark
diff --git a/src/catch2/benchmark/detail/catch_analyse.cpp b/src/catch2/benchmark/detail/catch_analyse.cpp
index 14d7f450..7edb27d1 100644
--- a/src/catch2/benchmark/detail/catch_analyse.cpp
+++ b/src/catch2/benchmark/detail/catch_analyse.cpp
@@ -46,7 +46,7 @@ namespace Catch {
std::vector samples2;
samples2.reserve(samples.size());
for (auto s : samples) {
- samples2.push_back( FDuration( s ) );
+ samples2.emplace_back( s );
}
return {
diff --git a/src/catch2/benchmark/detail/catch_benchmark_function.hpp b/src/catch2/benchmark/detail/catch_benchmark_function.hpp
index 90b07b76..f6371d48 100644
--- a/src/catch2/benchmark/detail/catch_benchmark_function.hpp
+++ b/src/catch2/benchmark/detail/catch_benchmark_function.hpp
@@ -21,7 +21,7 @@ namespace Catch {
namespace Benchmark {
namespace Detail {
template
- static constexpr bool is_related_v = std::is_same, std::decay_t>::value;
+ static constexpr bool is_related_v = std::is_same_v, std::decay_t>;
/// We need to reinvent std::function because every piece of code that might add overhead
/// in a measurement context needs to have consistent performance characteristics so that we
diff --git a/src/catch2/catch_all.hpp b/src/catch2/catch_all.hpp
index 2417d856..74db3ef0 100644
--- a/src/catch2/catch_all.hpp
+++ b/src/catch2/catch_all.hpp
@@ -57,11 +57,9 @@
#include
#include
#include
-#include
#include
#include
#include
-#include
#include
#include
#include
@@ -80,7 +78,6 @@
#include
#include
#include
-#include
#include
#include
#include
diff --git a/src/catch2/catch_approx.hpp b/src/catch2/catch_approx.hpp
index de4d2ab4..06da31f9 100644
--- a/src/catch2/catch_approx.hpp
+++ b/src/catch2/catch_approx.hpp
@@ -29,7 +29,7 @@ namespace Catch {
Approx operator-() const;
- template ::value>>
+ template >>
Approx operator()( T const& value ) const {
Approx approx( static_cast(value) );
approx.m_epsilon = m_epsilon;
@@ -38,67 +38,67 @@ namespace Catch {
return approx;
}
- template ::value>>
+ template >>
explicit Approx( T const& value ): Approx(static_cast(value))
{}
- template ::value>>
+ template >>
friend bool operator == ( const T& lhs, Approx const& rhs ) {
auto lhs_v = static_cast(lhs);
return rhs.equalityComparisonImpl(lhs_v);
}
- template ::value>>
+ template >>
friend bool operator == ( Approx const& lhs, const T& rhs ) {
return operator==( rhs, lhs );
}
- template ::value>>
+ template >>
friend bool operator != ( T const& lhs, Approx const& rhs ) {
return !operator==( lhs, rhs );
}
- template ::value>>
+ template >>
friend bool operator != ( Approx const& lhs, T const& rhs ) {
return !operator==( rhs, lhs );
}
- template ::value>>
+ template >>
friend bool operator <= ( T const& lhs, Approx const& rhs ) {
return static_cast(lhs) < rhs.m_value || lhs == rhs;
}
- template ::value>>
+ template >>
friend bool operator <= ( Approx const& lhs, T const& rhs ) {
return lhs.m_value < static_cast(rhs) || lhs == rhs;
}
- template ::value>>
+ template >>
friend bool operator >= ( T const& lhs, Approx const& rhs ) {
return static_cast(lhs) > rhs.m_value || lhs == rhs;
}
- template ::value>>
+ template >>
friend bool operator >= ( Approx const& lhs, T const& rhs ) {
return lhs.m_value > static_cast(rhs) || lhs == rhs;
}
- template ::value>>
+ template >>
Approx& epsilon( T const& newEpsilon ) {
const auto epsilonAsDouble = static_cast(newEpsilon);
setEpsilon(epsilonAsDouble);
return *this;
}
- template ::value>>
+ template >>
Approx& margin( T const& newMargin ) {
const auto marginAsDouble = static_cast(newMargin);
setMargin(marginAsDouble);
return *this;
}
- template ::value>>
+ template >>
Approx& scale( T const& newScale ) {
m_scale = static_cast(newScale);
return *this;
diff --git a/src/catch2/catch_session.hpp b/src/catch2/catch_session.hpp
index 23fc6f80..86f7235a 100644
--- a/src/catch2/catch_session.hpp
+++ b/src/catch2/catch_session.hpp
@@ -16,7 +16,6 @@
namespace Catch {
- // TODO: Use C++17 `inline` variables
constexpr int UnspecifiedErrorExitCode = 1;
constexpr int NoTestsRunExitCode = 2;
constexpr int UnmatchedTestSpecExitCode = 3;
diff --git a/src/catch2/catch_tostring.cpp b/src/catch2/catch_tostring.cpp
index 4d80b173..cadfdb56 100644
--- a/src/catch2/catch_tostring.cpp
+++ b/src/catch2/catch_tostring.cpp
@@ -13,6 +13,7 @@
#include
#include
+#include
namespace Catch {
@@ -135,11 +136,9 @@ std::string StringMaker::convert(const std::string& str) {
return Detail::convertIntoString( str );
}
-#ifdef CATCH_CONFIG_CPP17_STRING_VIEW
std::string StringMaker::convert(std::string_view str) {
return Detail::convertIntoString( StringRef( str.data(), str.size() ) );
}
-#endif
std::string StringMaker::convert(char const* str) {
if (str) {
@@ -166,11 +165,9 @@ std::string StringMaker::convert(const std::wstring& wstr) {
return ::Catch::Detail::stringify(s);
}
-# ifdef CATCH_CONFIG_CPP17_STRING_VIEW
std::string StringMaker::convert(std::wstring_view str) {
return StringMaker::convert(std::wstring(str));
}
-# endif
std::string StringMaker::convert(wchar_t const * str) {
if (str) {
@@ -188,12 +185,9 @@ std::string StringMaker::convert(wchar_t * str) {
}
#endif
-#if defined(CATCH_CONFIG_CPP17_BYTE)
-#include
std::string StringMaker::convert(std::byte value) {
return ::Catch::Detail::stringify(std::to_integer(value));
}
-#endif // defined(CATCH_CONFIG_CPP17_BYTE)
std::string StringMaker::convert(int value) {
return ::Catch::Detail::stringify(static_cast(value));
diff --git a/src/catch2/catch_tostring.hpp b/src/catch2/catch_tostring.hpp
index 41f89413..bf6bcd56 100644
--- a/src/catch2/catch_tostring.hpp
+++ b/src/catch2/catch_tostring.hpp
@@ -20,9 +20,7 @@
#include
#include
-#ifdef CATCH_CONFIG_CPP17_STRING_VIEW
#include
-#endif
#ifdef _MSC_VER
#pragma warning(push)
@@ -78,13 +76,13 @@ namespace Catch {
template
std::enable_if_t<
- !std::is_enum::value && !std::is_base_of::value,
+ !std::is_enum_v && !std::is_base_of_v,
std::string> convertUnstreamable( T const& ) {
return std::string(Detail::unprintableString);
}
template
std::enable_if_t<
- !std::is_enum::value && std::is_base_of::value,
+ !std::is_enum_v && std::is_base_of_v,
std::string> convertUnstreamable(T const& ex) {
return ex.what();
}
@@ -92,7 +90,7 @@ namespace Catch {
template
std::enable_if_t<
- std::is_enum::value,
+ std::is_enum_v,
std::string> convertUnstreamable( T const& value ) {
return convertUnknownEnumToString( value );
}
@@ -173,12 +171,10 @@ namespace Catch {
static std::string convert(const std::string& str);
};
-#ifdef CATCH_CONFIG_CPP17_STRING_VIEW
template<>
struct StringMaker {
static std::string convert(std::string_view str);
};
-#endif
template<>
struct StringMaker {
@@ -195,12 +191,10 @@ namespace Catch {
static std::string convert(const std::wstring& wstr);
};
-# ifdef CATCH_CONFIG_CPP17_STRING_VIEW
template<>
struct StringMaker {
static std::string convert(std::wstring_view str);
};
-# endif
template<>
struct StringMaker {
@@ -236,12 +230,10 @@ namespace Catch {
}
};
-#if defined(CATCH_CONFIG_CPP17_BYTE)
template<>
struct StringMaker {
static std::string convert(std::byte value);
};
-#endif // defined(CATCH_CONFIG_CPP17_BYTE)
template<>
struct StringMaker {
static std::string convert(int value);
@@ -387,7 +379,7 @@ namespace Catch {
}
#endif // CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER
-#if defined(CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER) && defined(CATCH_CONFIG_CPP17_OPTIONAL)
+#if defined(CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER)
#include
namespace Catch {
template
@@ -417,7 +409,7 @@ namespace Catch {
template<
typename Tuple,
std::size_t N = 0,
- bool = (N < std::tuple_size::value)
+ bool = (N < std::tuple_size_v)
>
struct TupleElementPrinter {
static void print(const Tuple& tuple, std::ostream& os) {
@@ -451,7 +443,7 @@ namespace Catch {
}
#endif // CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER
-#if defined(CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER) && defined(CATCH_CONFIG_CPP17_VARIANT)
+#if defined(CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER)
#include
namespace Catch {
template<>
diff --git a/src/catch2/catch_user_config.hpp.in b/src/catch2/catch_user_config.hpp.in
index 18e2ef1a..880ec665 100644
--- a/src/catch2/catch_user_config.hpp.in
+++ b/src/catch2/catch_user_config.hpp.in
@@ -60,56 +60,6 @@
-#cmakedefine CATCH_CONFIG_CPP17_BYTE
-#cmakedefine CATCH_CONFIG_NO_CPP17_BYTE
-
-#if defined( CATCH_CONFIG_CPP17_BYTE ) && \
- defined( CATCH_CONFIG_NO_CPP17_BYTE )
-# error Cannot force CPP17_BYTE to both ON and OFF
-#endif
-
-
-
-#cmakedefine CATCH_CONFIG_CPP17_OPTIONAL
-#cmakedefine CATCH_CONFIG_NO_CPP17_OPTIONAL
-
-#if defined( CATCH_CONFIG_CPP17_OPTIONAL ) && \
- defined( CATCH_CONFIG_NO_CPP17_OPTIONAL )
-# error Cannot force CPP17_OPTIONAL to both ON and OFF
-#endif
-
-
-
-#cmakedefine CATCH_CONFIG_CPP17_STRING_VIEW
-#cmakedefine CATCH_CONFIG_NO_CPP17_STRING_VIEW
-
-#if defined( CATCH_CONFIG_CPP17_STRING_VIEW ) && \
- defined( CATCH_CONFIG_NO_CPP17_STRING_VIEW )
-# error Cannot force CPP17_STRING_VIEW to both ON and OFF
-#endif
-
-
-
-#cmakedefine CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS
-#cmakedefine CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS
-
-#if defined( CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS ) && \
- defined( CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS )
-# error Cannot force CPP17_UNCAUGHT_EXCEPTIONS to both ON and OFF
-#endif
-
-
-
-#cmakedefine CATCH_CONFIG_CPP17_VARIANT
-#cmakedefine CATCH_CONFIG_NO_CPP17_VARIANT
-
-#if defined( CATCH_CONFIG_CPP17_VARIANT ) && \
- defined( CATCH_CONFIG_NO_CPP17_VARIANT )
-# error Cannot force CPP17_VARIANT to both ON and OFF
-#endif
-
-
-
#cmakedefine CATCH_CONFIG_GLOBAL_NEXTAFTER
#cmakedefine CATCH_CONFIG_NO_GLOBAL_NEXTAFTER
diff --git a/src/catch2/generators/catch_generators.hpp b/src/catch2/generators/catch_generators.hpp
index 0f35a996..0690bf6a 100644
--- a/src/catch2/generators/catch_generators.hpp
+++ b/src/catch2/generators/catch_generators.hpp
@@ -88,7 +88,7 @@ namespace Detail {
template
class FixedValuesGenerator final : public IGenerator {
- static_assert(!std::is_same::value,
+ static_assert(!std::is_same_v,
"FixedValuesGenerator does not support bools because of std::vector"
"specialization, use SingleValue Generator instead.");
std::vector m_values;
@@ -131,7 +131,7 @@ namespace Detail {
m_generators.emplace_back( value( CATCH_MOVE( val ) ) );
}
template
- std::enable_if_t, T>::value>
+ std::enable_if_t, T>>
add_generator( U&& val ) {
add_generator( T( CATCH_FORWARD( val ) ) );
}
diff --git a/src/catch2/generators/catch_generators_adapters.hpp b/src/catch2/generators/catch_generators_adapters.hpp
index f623bd29..f0418ebd 100644
--- a/src/catch2/generators/catch_generators_adapters.hpp
+++ b/src/catch2/generators/catch_generators_adapters.hpp
@@ -58,7 +58,7 @@ namespace Generators {
class FilterGenerator final : public IGenerator {
GeneratorWrapper m_generator;
Predicate m_predicate;
- static_assert(!std::is_reference::value, "This would most likely result in a dangling reference");
+ static_assert(!std::is_reference_v, "This would most likely result in a dangling reference");
public:
template
FilterGenerator(P&& pred, GeneratorWrapper&& generator):
@@ -97,7 +97,7 @@ namespace Generators {
template
class RepeatGenerator final : public IGenerator {
- static_assert(!std::is_same::value,
+ static_assert(!std::is_same_v,
"RepeatGenerator currently does not support bools"
"because of std::vector specialization");
GeneratorWrapper m_generator;
diff --git a/src/catch2/generators/catch_generators_random.hpp b/src/catch2/generators/catch_generators_random.hpp
index 71283561..49e6052d 100644
--- a/src/catch2/generators/catch_generators_random.hpp
+++ b/src/catch2/generators/catch_generators_random.hpp
@@ -83,7 +83,7 @@ public:
};
template
-std::enable_if_t::value, GeneratorWrapper>
+std::enable_if_t, GeneratorWrapper>
random(T a, T b) {
return GeneratorWrapper(
Catch::Detail::make_unique>(a, b, Detail::getSeed())
@@ -91,7 +91,7 @@ random(T a, T b) {
}
template
-std::enable_if_t::value,
+std::enable_if_t,
GeneratorWrapper>
random(T a, T b) {
return GeneratorWrapper(
diff --git a/src/catch2/generators/catch_generators_range.hpp b/src/catch2/generators/catch_generators_range.hpp
index 55d673c2..159459d8 100644
--- a/src/catch2/generators/catch_generators_range.hpp
+++ b/src/catch2/generators/catch_generators_range.hpp
@@ -52,20 +52,20 @@ public:
template
GeneratorWrapper range(T const& start, T const& end, T const& step) {
- static_assert(std::is_arithmetic::value && !std::is_same::value, "Type must be numeric");
+ static_assert(std::is_arithmetic_v && !std::is_same_v, "Type must be numeric");
return GeneratorWrapper(Catch::Detail::make_unique>(start, end, step));
}
template
GeneratorWrapper range(T const& start, T const& end) {
- static_assert(std::is_integral::value && !std::is_same::value, "Type must be an integer");
+ static_assert(std::is_integral_v && !std::is_same_v, "Type must be an integer");
return GeneratorWrapper(Catch::Detail::make_unique>(start, end));
}
template
class IteratorGenerator final : public IGenerator {
- static_assert(!std::is_same::value,
+ static_assert(!std::is_same_v,
"IteratorGenerator currently does not support bools"
"because of std::vector specialization");
diff --git a/src/catch2/internal/catch_clara.hpp b/src/catch2/internal/catch_clara.hpp
index 85874a15..49983b54 100644
--- a/src/catch2/internal/catch_clara.hpp
+++ b/src/catch2/internal/catch_clara.hpp
@@ -20,14 +20,7 @@
# pragma GCC diagnostic ignored "-Wsign-conversion"
#endif
-#ifndef CLARA_CONFIG_OPTIONAL_TYPE
-# ifdef __has_include
-# if __has_include( ) && __cplusplus >= 201703L
-# include
-# define CLARA_CONFIG_OPTIONAL_TYPE std::optional
-# endif
-# endif
-#endif
+#include
#include
#include
@@ -328,10 +321,9 @@ namespace Catch {
std::string& target );
ParserResult convertInto( std::string const& source, bool& target );
-#ifdef CLARA_CONFIG_OPTIONAL_TYPE
template
auto convertInto( std::string const& source,
- CLARA_CONFIG_OPTIONAL_TYPE& target )
+ std::optional& target )
-> ParserResult {
T temp;
auto result = convertInto( source, temp );
@@ -339,7 +331,6 @@ namespace Catch {
target = CATCH_MOVE( temp );
return result;
}
-#endif // CLARA_CONFIG_OPTIONAL_TYPE
struct BoundRef : Catch::Detail::NonCopyable {
virtual ~BoundRef() = default;
@@ -393,7 +384,7 @@ namespace Catch {
template struct LambdaInvoker {
static_assert(
- std::is_same::value,
+ std::is_same_v,
"Lambda must return void or clara::ParserResult" );
template
@@ -449,8 +440,8 @@ namespace Catch {
UnaryLambdaTraits::isValid,
"Supplied lambda must take exactly one argument" );
static_assert(
- std::is_same::ArgType,
- bool>::value,
+ std::is_same_v::ArgType,
+ bool>,
"flags must be boolean" );
explicit BoundFlagLambda( L const& lambda ):
diff --git a/src/catch2/internal/catch_compiler_capabilities.hpp b/src/catch2/internal/catch_compiler_capabilities.hpp
index 983fb63b..72fa55b0 100644
--- a/src/catch2/internal/catch_compiler_capabilities.hpp
+++ b/src/catch2/internal/catch_compiler_capabilities.hpp
@@ -29,10 +29,6 @@
#ifdef __cplusplus
-# if (__cplusplus >= 201703L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
-# define CATCH_CPP17_OR_GREATER
-# endif
-
# if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L)
# define CATCH_CPP20_OR_GREATER
# endif
@@ -198,8 +194,7 @@
# define _BSD_SOURCE
// some versions of cygwin (most) do not support std::to_string. Use the libstd check.
// https://gcc.gnu.org/onlinedocs/gcc-4.8.2/libstdc++/api/a01053_source.html line 2812-2813
-# if !((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99) \
- && !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF))
+# if !(defined(_GLIBCXX_USE_C99) && !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF))
# define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING
@@ -275,43 +270,6 @@
#define CATCH_INTERNAL_CONFIG_GLOBAL_NEXTAFTER
#endif
-// Various stdlib support checks that require __has_include
-#if defined(__has_include)
- // Check if string_view is available and usable
- #if __has_include() && defined(CATCH_CPP17_OR_GREATER)
- # define CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW
- #endif
-
- // Check if optional is available and usable
- # if __has_include() && defined(CATCH_CPP17_OR_GREATER)
- # define CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL
- # endif // __has_include() && defined(CATCH_CPP17_OR_GREATER)
-
- // Check if byte is available and usable
- # if __has_include() && defined(CATCH_CPP17_OR_GREATER)
- # include
- # if defined(__cpp_lib_byte) && (__cpp_lib_byte > 0)
- # define CATCH_INTERNAL_CONFIG_CPP17_BYTE
- # endif
- # endif // __has_include() && defined(CATCH_CPP17_OR_GREATER)
-
- // Check if variant is available and usable
- # if __has_include() && defined(CATCH_CPP17_OR_GREATER)
- # if defined(__clang__) && (__clang_major__ < 8)
- // work around clang bug with libstdc++ https://bugs.llvm.org/show_bug.cgi?id=31852
- // fix should be in clang 8, workaround in libstdc++ 8.2
- # include
- # if defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9)
- # define CATCH_CONFIG_NO_CPP17_VARIANT
- # else
- # define CATCH_INTERNAL_CONFIG_CPP17_VARIANT
- # endif // defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9)
- # else
- # define CATCH_INTERNAL_CONFIG_CPP17_VARIANT
- # endif // defined(__clang__) && (__clang_major__ < 8)
- # endif // __has_include() && defined(CATCH_CPP17_OR_GREATER)
-#endif // defined(__has_include)
-
#if defined(CATCH_INTERNAL_CONFIG_WINDOWS_SEH) && !defined(CATCH_CONFIG_NO_WINDOWS_SEH) && !defined(CATCH_CONFIG_WINDOWS_SEH) && !defined(CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH)
# define CATCH_CONFIG_WINDOWS_SEH
@@ -329,22 +287,6 @@
# define CATCH_CONFIG_CPP11_TO_STRING
#endif
-#if defined(CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL) && !defined(CATCH_CONFIG_NO_CPP17_OPTIONAL) && !defined(CATCH_CONFIG_CPP17_OPTIONAL)
-# define CATCH_CONFIG_CPP17_OPTIONAL
-#endif
-
-#if defined(CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_NO_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_CPP17_STRING_VIEW)
-# define CATCH_CONFIG_CPP17_STRING_VIEW
-#endif
-
-#if defined(CATCH_INTERNAL_CONFIG_CPP17_VARIANT) && !defined(CATCH_CONFIG_NO_CPP17_VARIANT) && !defined(CATCH_CONFIG_CPP17_VARIANT)
-# define CATCH_CONFIG_CPP17_VARIANT
-#endif
-
-#if defined(CATCH_INTERNAL_CONFIG_CPP17_BYTE) && !defined(CATCH_CONFIG_NO_CPP17_BYTE) && !defined(CATCH_CONFIG_CPP17_BYTE)
-# define CATCH_CONFIG_CPP17_BYTE
-#endif
-
#if defined(CATCH_CONFIG_EXPERIMENTAL_REDIRECT)
# define CATCH_INTERNAL_CONFIG_NEW_CAPTURE
diff --git a/src/catch2/internal/catch_config_uncaught_exceptions.hpp b/src/catch2/internal/catch_config_uncaught_exceptions.hpp
deleted file mode 100644
index 20b1dfca..00000000
--- a/src/catch2/internal/catch_config_uncaught_exceptions.hpp
+++ /dev/null
@@ -1,46 +0,0 @@
-
-// Copyright Catch2 Authors
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE.txt or copy at
-// https://www.boost.org/LICENSE_1_0.txt)
-
-// SPDX-License-Identifier: BSL-1.0
-
-/** \file
- * Wrapper for UNCAUGHT_EXCEPTIONS configuration option
- *
- * For some functionality, Catch2 requires to know whether there is
- * an active exception. Because `std::uncaught_exception` is deprecated
- * in C++17, we want to use `std::uncaught_exceptions` if possible.
- */
-
-#ifndef CATCH_CONFIG_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED
-#define CATCH_CONFIG_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED
-
-#include
-
-#if defined(_MSC_VER)
-# if _MSC_VER >= 1900 // Visual Studio 2015 or newer
-# define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS
-# endif
-#endif
-
-
-#include
-
-#if defined(__cpp_lib_uncaught_exceptions) \
- && !defined(CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS)
-
-# define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS
-#endif // __cpp_lib_uncaught_exceptions
-
-
-#if defined(CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) \
- && !defined(CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS) \
- && !defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS)
-
-# define CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS
-#endif
-
-
-#endif // CATCH_CONFIG_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED
diff --git a/src/catch2/internal/catch_container_nonmembers.hpp b/src/catch2/internal/catch_container_nonmembers.hpp
deleted file mode 100644
index 33b28a9e..00000000
--- a/src/catch2/internal/catch_container_nonmembers.hpp
+++ /dev/null
@@ -1,73 +0,0 @@
-
-// Copyright Catch2 Authors
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE.txt or copy at
-// https://www.boost.org/LICENSE_1_0.txt)
-
-// SPDX-License-Identifier: BSL-1.0
-#ifndef CATCH_CONTAINER_NONMEMBERS_HPP_INCLUDED
-#define CATCH_CONTAINER_NONMEMBERS_HPP_INCLUDED
-
-#include
-
-#include
-#include
-
-// We want a simple polyfill over `std::empty`, `std::size` and so on
-// for C++14 or C++ libraries with incomplete support.
-// We also have to handle that MSVC std lib will happily provide these
-// under older standards.
-#if defined(CATCH_CPP17_OR_GREATER) || defined(_MSC_VER)
-
-// We are already using this header either way, so there shouldn't
-// be much additional overhead in including it to get the feature
-// test macros
-#include
-
-# if !defined(__cpp_lib_nonmember_container_access)
-# define CATCH_CONFIG_POLYFILL_NONMEMBER_CONTAINER_ACCESS
-# endif
-
-#else
-#define CATCH_CONFIG_POLYFILL_NONMEMBER_CONTAINER_ACCESS
-#endif
-
-
-
-namespace Catch {
-namespace Detail {
-
-#if defined(CATCH_CONFIG_POLYFILL_NONMEMBER_CONTAINER_ACCESS)
- template
- constexpr auto empty(Container const& cont) -> decltype(cont.empty()) {
- return cont.empty();
- }
- template
- constexpr bool empty(const T (&)[N]) noexcept {
- // GCC < 7 does not support the const T(&)[] parameter syntax
- // so we have to ignore the length explicitly
- (void)N;
- return false;
- }
- template
- constexpr bool empty(std::initializer_list list) noexcept {
- return list.size() > 0;
- }
-
-
- template
- constexpr auto size(Container const& cont) -> decltype(cont.size()) {
- return cont.size();
- }
- template
- constexpr std::size_t size(const T(&)[N]) noexcept {
- return N;
- }
-#endif // CATCH_CONFIG_POLYFILL_NONMEMBER_CONTAINER_ACCESS
-
-} // end namespace Detail
-} // end namespace Catch
-
-
-
-#endif // CATCH_CONTAINER_NONMEMBERS_HPP_INCLUDED
diff --git a/src/catch2/internal/catch_decomposer.hpp b/src/catch2/internal/catch_decomposer.hpp
index fcc017dd..18398dc4 100644
--- a/src/catch2/internal/catch_decomposer.hpp
+++ b/src/catch2/internal/catch_decomposer.hpp
@@ -12,7 +12,6 @@
#include
#include
#include
-#include
#include
#include
@@ -129,7 +128,7 @@
namespace Catch {
namespace Detail {
- // This was added in C++20, but we require only C++14 for now.
+ // This was added in C++20, but we require only C++17 for now.
template
using RemoveCVRef_t = std::remove_cv_t>;
}
@@ -148,8 +147,8 @@ namespace Catch {
template
struct capture_by_value
: std::integral_constant::value ||
- std::is_enum::value> {};
+ std::is_arithmetic_v ||
+ std::is_enum_v> {};
#if defined( CATCH_CONFIG_CPP20_COMPARE_OVERLOADS )
template <>
@@ -294,9 +293,9 @@ namespace Catch {
template \
constexpr friend auto operator op( ExprLhs&& lhs, RhsT&& rhs ) \
-> std::enable_if_t< \
- Detail::conjunction, \
- Detail::negation>>>::value, \
+ std::conjunction_v, \
+ std::negation>>>, \
BinaryExpr> { \
return { \
static_cast( lhs.m_lhs op rhs ), lhs.m_lhs, #op##_sr, rhs }; \
@@ -304,8 +303,8 @@ namespace Catch {
template \
constexpr friend auto operator op( ExprLhs&& lhs, RhsT rhs ) \
-> std::enable_if_t< \
- Detail::conjunction, \
- capture_by_value>::value, \
+ std::conjunction_v, \
+ capture_by_value>, \
BinaryExpr> { \
return { \
static_cast( lhs.m_lhs op rhs ), lhs.m_lhs, #op##_sr, rhs }; \
@@ -313,12 +312,12 @@ namespace Catch {
template \
constexpr friend auto operator op( ExprLhs&& lhs, RhsT rhs ) \
-> std::enable_if_t< \
- Detail::conjunction< \
- Detail::negation>, \
+ std::conjunction_v< \
+ std::negation>, \
Detail::is_eq_0_comparable, \
/* We allow long because we want `ptr op NULL` to be accepted */ \
- Detail::disjunction, \
- std::is_same>>::value, \
+ std::disjunction, \
+ std::is_same>>, \
BinaryExpr> { \
if ( rhs != 0 ) { throw_test_failure_exception(); } \
return { \
@@ -327,12 +326,12 @@ namespace Catch {
template \
constexpr friend auto operator op( ExprLhs&& lhs, RhsT rhs ) \
-> std::enable_if_t< \
- Detail::conjunction< \
- Detail::negation>, \
+ std::conjunction_v< \
+ std::negation>, \
Detail::is_eq_0_comparable, \
/* We allow long because we want `ptr op NULL` to be accepted */ \
- Detail::disjunction, \
- std::is_same>>::value, \
+ std::disjunction, \
+ std::is_same>>, \
BinaryExpr> { \
if ( lhs.m_lhs != 0 ) { throw_test_failure_exception(); } \
return { static_cast