diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index 4fb866f..0b33ef0 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -46,7 +46,8 @@ jobs: "tests": [ "Debug.Default", "Release.Default", "Release.TSan", "Release.MaxSan", "Debug.Werror", - "Debug.Coverage", "Debug.-DBEMAN_EXPECTED_USE_MODULES=On" + "Debug.Coverage", "Debug.-DBEMAN_EXPECTED_USE_MODULES=On", + "Debug.-DCMAKE_CXX_FLAGS=-freflection" ] } ] diff --git a/CMakePresets.json b/CMakePresets.json index 09df0e5..08a4cb4 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -51,6 +51,28 @@ "CMAKE_TOOLCHAIN_FILE": "${sourceDir}/infra/cmake/gnu-toolchain.cmake" } }, + { + "name": "gcc-16-debug", + "displayName": "GCC 16 Debug Build (C++26, reflection)", + "inherits": [ + "_root-config" + ], + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_TOOLCHAIN_FILE": "${sourceDir}/cmake/gcc-16-toolchain.cmake" + } + }, + { + "name": "gcc-16-release", + "displayName": "GCC 16 Release Build (C++26, reflection)", + "inherits": [ + "_root-config", + "_release-base" + ], + "cacheVariables": { + "CMAKE_TOOLCHAIN_FILE": "${sourceDir}/cmake/gcc-16-toolchain.cmake" + } + }, { "name": "llvm-debug", "displayName": "Clang Debug Build", @@ -172,6 +194,20 @@ "_root-build" ] }, + { + "name": "gcc-16-debug", + "configurePreset": "gcc-16-debug", + "inherits": [ + "_root-build" + ] + }, + { + "name": "gcc-16-release", + "configurePreset": "gcc-16-release", + "inherits": [ + "_root-build" + ] + }, { "name": "llvm-debug", "configurePreset": "llvm-debug", @@ -237,6 +273,16 @@ "inherits": "_test_base", "configurePreset": "gcc-release" }, + { + "name": "gcc-16-debug", + "inherits": "_test_base", + "configurePreset": "gcc-16-debug" + }, + { + "name": "gcc-16-release", + "inherits": "_test_base", + "configurePreset": "gcc-16-release" + }, { "name": "llvm-debug", "inherits": "_test_base", @@ -303,6 +349,40 @@ } ] }, + { + "name": "gcc-16-debug", + "steps": [ + { + "type": "configure", + "name": "gcc-16-debug" + }, + { + "type": "build", + "name": "gcc-16-debug" + }, + { + "type": "test", + "name": "gcc-16-debug" + } + ] + }, + { + "name": "gcc-16-release", + "steps": [ + { + "type": "configure", + "name": "gcc-16-release" + }, + { + "type": "build", + "name": "gcc-16-release" + }, + { + "type": "test", + "name": "gcc-16-release" + } + ] + }, { "name": "llvm-debug", "steps": [ diff --git a/tests/beman/expected/CMakeLists.txt b/tests/beman/expected/CMakeLists.txt index 134c2bc..21250ec 100644 --- a/tests/beman/expected/CMakeLists.txt +++ b/tests/beman/expected/CMakeLists.txt @@ -41,6 +41,7 @@ set(beman_expected_beman_only_tests expected_review_corrections.test.cpp expected_smf_regressions.test.cpp header_idempotence.test.cpp + type_name.test.cpp ) include(Catch) diff --git a/tests/beman/expected/type_name.test.cpp b/tests/beman/expected/type_name.test.cpp new file mode 100644 index 0000000..c88d8b0 --- /dev/null +++ b/tests/beman/expected/type_name.test.cpp @@ -0,0 +1,26 @@ +// tests/beman/expected/type_name.test.cpp -*-C++-*- +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Beman-only: a compiler with reflection gets the reflection implementation of +// testing/type_name.hpp. +// +// The selection needs both the compiler's __cpp_impl_reflection and the +// library's __cpp_lib_reflection, and falling back is silent: every other test +// still passes using the fallback. So whenever the compiler has reflection, +// check that it was used. A build that forces an implementation with +// BEMAN_EXPECTED_TESTING_TYPE_NAME_USE_REFLECTION has made its own choice, and +// is not second-guessed. + +#if defined(BEMAN_EXPECTED_TESTING_TYPE_NAME_USE_REFLECTION) + #define BEMAN_EXPECTED_TESTING_TYPE_NAME_FORCED +#endif + +#include + +#include + +#if defined(__cpp_impl_reflection) && !defined(BEMAN_EXPECTED_TESTING_TYPE_NAME_FORCED) +TEST_CASE("type_name: a compiler with reflection gets the reflection implementation", "[type_name]") { + CHECK(BEMAN_EXPECTED_TESTING_TYPE_NAME_USE_REFLECTION == 1); +} +#endif