C++ starter project fails to build with Clang 20+ due to Catch2 bug

Viewed 7

Hello! I just started looking at the C++ course, and while the starter project compiles fine in a Debian VM, the Catch2 subproject is currently failing to compile in macOS 26.4.1.

As far as I can tell, it's not an issue with the starter project itself, but appears to be the result of this issue, which would mean it will probably fail on any system with Clang version 20+ as its compiler: https://github.com/catchorg/Catch2/issues/2991

Just wanted to report it in case others have the same problem.

Complete terminal output:

╭─kaj@Starman in ~/Workspace/learning/c++/cpp-starter-project on master ✔ (origin/master)
╰$ clang -v
Apple clang version 21.0.0 (clang-2100.0.123.102)
Target: arm64-apple-darwin25.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

╭─kaj@Starman in ~/Workspace/learning/c++/cpp-starter-project on master ✔ (origin/master)
╰$ make
meson compile -j 10 -C /Users/kaj/Workspace/learning/c++/cpp-starter-project//builddir
INFO: autodetecting backend as ninja
INFO: calculating backend command to run: /opt/local/bin/ninja -C /Users/kaj/Workspace/learning/c++/cpp-starter-project/builddir -j 10
ninja: Entering directory `/Users/kaj/Workspace/learning/c++/cpp-starter-project/builddir'
[210/609] Compiling C object subprojects/libvorbis-1.3.7/lib/libvorbis.a.p/floor1.c.o
../subprojects/libvorbis-1.3.7/lib/floor1.c:458:26: warning: variable 'y2b' set but not used [-Wunused-but-set-variable]
  458 |   double xb=0,yb=0,x2b=0,y2b=0,xyb=0,bn=0;
      |                          ^
1 warning generated.
[222/609] Compiling C object subprojects/libvorbis-1.3.7/lib/libvorbisfile.a.p/vorbisfile.c.o
../subprojects/libvorbis-1.3.7/lib/vorbisfile.c:1992:24: warning: unused variable 'fpu' [-Wunused-variable]
 1992 |     vorbis_fpu_control fpu;
      |                        ^~~
1 warning generated.
[249/609] Compiling C object subprojects/SFML-3.0.0/libvorbis.a.p/b...368d288a4ca0a56059c4a5___CMake_build__deps_vorbis-src_lib_floor1.c.
/Users/kaj/Workspace/learning/c++/cpp-starter-project/builddir/subprojects/SFML-3.0.0/__CMake_build/_deps/vorbis-src/lib/floor1.c:458:26: warning: variable 'y2b' set but not used [-Wunused-but-set-variable]
  458 |   double xb=0,yb=0,x2b=0,y2b=0,xyb=0,bn=0;
      |                          ^
1 warning generated.
[260/609] Compiling C object subprojects/SFML-3.0.0/libvorbisfile.a...55c4e2aff1ac2f5bbd___CMake_build__deps_vorbis-src_lib_vorbisfile.c.
/Users/kaj/Workspace/learning/c++/cpp-starter-project/builddir/subprojects/SFML-3.0.0/__CMake_build/_deps/vorbis-src/lib/vorbisfile.c:1992:24: warning: unused variable 'fpu' [-Wunused-variable]
 1992 |     vorbis_fpu_control fpu;
      |                        ^~~
1 warning generated.
[340/609] Compiling Objective-C++ object subprojects/SFML-3.0.0/libsfml_window.a.p/src_SFML_Window_macOS_InputImpl.mm.o
../subprojects/SFML-3.0.0/src/SFML/Window/macOS/InputImpl.mm:66:16: warning: incompatible pointer types assigning to 'SFOpenGLView *' from 'NSView * _Nullable' [-Wincompatible-pointer-types]
   66 |         view = [nsHandle contentView];
      |                ^~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
[377/609] Compiling C object subprojects/SFML-3.0.0/libfreetype.a.p...e5a5d982296a58b6857ec16529b6b__deps_freetype-src_src_gzip_ftgzip.c.
In file included from /Users/kaj/Workspace/learning/c++/cpp-starter-project/builddir/subprojects/SFML-3.0.0/__CMake_build/_deps/freetype-src/src/gzip/ftgzip.c:99:
In file included from /Users/kaj/Workspace/learning/c++/cpp-starter-project/builddir/subprojects/SFML-3.0.0/__CMake_build/_deps/freetype-src/src/gzip/zutil.c:8:
/Users/kaj/Workspace/learning/c++/cpp-starter-project/builddir/subprojects/SFML-3.0.0/__CMake_build/_deps/freetype-src/src/gzip/zutil.h:172:11: warning: 'OS_CODE' macro redefined [-Wmacro-redefined]
  172 | #  define OS_CODE 19
      |           ^
/Users/kaj/Workspace/learning/c++/cpp-starter-project/builddir/subprojects/SFML-3.0.0/__CMake_build/_deps/freetype-src/src/gzip/zutil.h:143:11: note: previous definition is here
  143 | #  define OS_CODE  7
      |           ^
1 warning generated.
[458/609] Compiling C++ object subprojects/box2d-2.4.1/src/libbox2d.a.p/dynamics_b2_distance_joint.cpp.o
../subprojects/box2d-2.4.1/src/dynamics/b2_distance_joint.cpp:395:8: warning: unused variable 'length' [-Wunused-variable]
  395 |         float length = axis.Normalize();
      |               ^~~~~~
1 warning generated.
[467/609] Compiling C++ object subprojects/box2d-2.4.1/src/libbox2d.a.p/dynamics_b2_mouse_joint.cpp.o
../subprojects/box2d-2.4.1/src/dynamics/b2_mouse_joint.cpp:87:8: warning: unused variable 'mass' [-Wunused-variable]
   87 |         float mass = m_bodyB->GetMass();
      |               ^~~~
1 warning generated.
[522/609] Compiling C++ object subprojects/Catch2-3.7.1/tests/SelfTest.p/SelfTest_UsageTests_Misc.tests.cpp.o
FAILED: [code=1] subprojects/Catch2-3.7.1/tests/SelfTest.p/SelfTest_UsageTests_Misc.tests.cpp.o 
c++ -Isubprojects/Catch2-3.7.1/tests/SelfTest.p -Isubprojects/Catch2-3.7.1/tests -I../subprojects/Catch2-3.7.1/tests -Isubprojects/Catch2-3.7.1/src -I../subprojects/Catch2-3.7.1/src -I../subprojects/Catch2-3.7.1/tests/SelfTest -fdiagnostics-color=always -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST -Wall -Winvalid-pch -std=c++23 -O0 -g -D_GLIBCXX_DEBUG=1 -D_GLIBCXX_DEBUG_PEDANTIC=1 -MD -MQ subprojects/Catch2-3.7.1/tests/SelfTest.p/SelfTest_UsageTests_Misc.tests.cpp.o -MF subprojects/Catch2-3.7.1/tests/SelfTest.p/SelfTest_UsageTests_Misc.tests.cpp.o.d -o subprojects/Catch2-3.7.1/tests/SelfTest.p/SelfTest_UsageTests_Misc.tests.cpp.o -c ../subprojects/Catch2-3.7.1/tests/SelfTest/UsageTests/Misc.tests.cpp
../subprojects/Catch2-3.7.1/tests/SelfTest/UsageTests/Misc.tests.cpp:387:1: error: no matching function for call to 'get_wrapper'
  387 | TEMPLATE_PRODUCT_TEST_CASE("Product with differing arities", "[template][product]", std::tuple, (int, (int, double), (int, double, float))) {
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../subprojects/Catch2-3.7.1/src/catch2/catch_template_test_macros.hpp:80:47: note: expanded from macro 'TEMPLATE_PRODUCT_TEST_CASE'
   80 |     #define TEMPLATE_PRODUCT_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE( __VA_ARGS__ )
      |                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../subprojects/Catch2-3.7.1/src/catch2/internal/catch_template_test_registry.hpp:155:9: note: expanded from macro 'INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE'
  155 |         INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), Name, Tags, typename T,__VA_ARGS__)
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../subprojects/Catch2-3.7.1/src/catch2/internal/catch_template_test_registry.hpp:142:69: note: expanded from macro 'INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2'
  142 |                 using TestInit = typename create<TestName, decltype(get_wrapper<INTERNAL_CATCH_REMOVE_PARENS(TmplTypes)>()), TypeList<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(INTERNAL_CATCH_REMOVE_PARENS(TypesList))>>::type; \
      |                                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../subprojects/Catch2-3.7.1/tests/SelfTest/UsageTests/Misc.tests.cpp:387:1: note: candidate template ignored: substitution failure [with Cs = <std::tuple>]: conflicting deduction 'std::tuple' against 'type-parameter-0-0' for parameter
../subprojects/Catch2-3.7.1/src/catch2/catch_template_test_macros.hpp:80:47: note: expanded from macro 'TEMPLATE_PRODUCT_TEST_CASE'
   80 |     #define TEMPLATE_PRODUCT_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE( __VA_ARGS__ )
      |                                               ^
../subprojects/Catch2-3.7.1/src/catch2/internal/catch_template_test_registry.hpp:155:9: note: expanded from macro 'INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE'
  155 |         INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), Name, Tags, typename T,__VA_ARGS__)
      |         ^
../subprojects/Catch2-3.7.1/src/catch2/internal/catch_template_test_registry.hpp:128:13: note: expanded from macro 'INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2'
  128 |             INTERNAL_CATCH_TYPE_GEN                                                  \
      |             ^
../subprojects/Catch2-3.7.1/src/catch2/internal/catch_preprocessor.hpp:108:20: note: expanded from macro 'INTERNAL_CATCH_TYPE_GEN'
  108 |     constexpr auto get_wrapper() noexcept -> TemplateTypeList<Cs...> { return {}; }\
      |                    ^
../subprojects/Catch2-3.7.1/tests/SelfTest/UsageTests/Misc.tests.cpp:387:1: note: candidate template ignored: invalid explicitly-specified argument for template parameter 'Ts'
../subprojects/Catch2-3.7.1/src/catch2/catch_template_test_macros.hpp:80:47: note: expanded from macro 'TEMPLATE_PRODUCT_TEST_CASE'
   80 |     #define TEMPLATE_PRODUCT_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE( __VA_ARGS__ )
      |                                               ^
../subprojects/Catch2-3.7.1/src/catch2/internal/catch_template_test_registry.hpp:155:9: note: expanded from macro 'INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE'
  155 |         INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), Name, Tags, typename T,__VA_ARGS__)
      |         ^
../subprojects/Catch2-3.7.1/src/catch2/internal/catch_template_test_registry.hpp:128:13: note: expanded from macro 'INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2'
  128 |             INTERNAL_CATCH_TYPE_GEN                                                  \
      |             ^
../subprojects/Catch2-3.7.1/src/catch2/internal/catch_preprocessor.hpp:105:20: note: expanded from macro 'INTERNAL_CATCH_TYPE_GEN'
  105 |     constexpr auto get_wrapper() noexcept -> TypeList<Ts...> { return {}; }\
      |                    ^
../subprojects/Catch2-3.7.1/tests/SelfTest/UsageTests/Misc.tests.cpp:387:1: error: expected a qualified name after 'typename'
  387 | TEMPLATE_PRODUCT_TEST_CASE("Product with differing arities", "[template][product]", std::tuple, (int, (int, double), (int, double, float))) {
      | ^
../subprojects/Catch2-3.7.1/src/catch2/catch_template_test_macros.hpp:80:47: note: expanded from macro 'TEMPLATE_PRODUCT_TEST_CASE'
   80 |     #define TEMPLATE_PRODUCT_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE( __VA_ARGS__ )
      |                                               ^
../subprojects/Catch2-3.7.1/src/catch2/internal/catch_template_test_registry.hpp:155:9: note: expanded from macro 'INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE'
  155 |         INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), Name, Tags, typename T,__VA_ARGS__)
      |         ^
../subprojects/Catch2-3.7.1/src/catch2/internal/catch_template_test_registry.hpp:142:43: note: expanded from macro 'INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2'
  142 |                 using TestInit = typename create<TestName, decltype(get_wrapper<INTERNAL_CATCH_REMOVE_PARENS(TmplTypes)>()), TypeList<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(INTERNAL_CATCH_REMOVE_PARENS(TypesList))>>::type; \
      |                                           ^
../subprojects/Catch2-3.7.1/tests/SelfTest/UsageTests/Misc.tests.cpp:387:1: error: expected ';' after alias declaration
../subprojects/Catch2-3.7.1/src/catch2/catch_template_test_macros.hpp:80:47: note: expanded from macro 'TEMPLATE_PRODUCT_TEST_CASE'
   80 |     #define TEMPLATE_PRODUCT_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE( __VA_ARGS__ )
      |                                               ^
../subprojects/Catch2-3.7.1/src/catch2/internal/catch_template_test_registry.hpp:155:9: note: expanded from macro 'INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE'
  155 |         INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), Name, Tags, typename T,__VA_ARGS__)
      |         ^
../subprojects/Catch2-3.7.1/src/catch2/internal/catch_template_test_registry.hpp:142:218: note: expanded from macro 'INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2'
  142 |                 using TestInit = typename create<TestName, decltype(get_wrapper<INTERNAL_CATCH_REMOVE_PARENS(TmplTypes)>()), TypeList<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(INTERNAL_CATCH_REMOVE_PARENS(TypesList))>>::type; \
      |                                                                                                                                                                                                                          ^
../subprojects/Catch2-3.7.1/tests/SelfTest/UsageTests/Misc.tests.cpp:387:1: error: unknown type name 'TestInit'
../subprojects/Catch2-3.7.1/src/catch2/catch_template_test_macros.hpp:80:47: note: expanded from macro 'TEMPLATE_PRODUCT_TEST_CASE'
   80 |     #define TEMPLATE_PRODUCT_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE( __VA_ARGS__ )
      |                                               ^
../subprojects/Catch2-3.7.1/src/catch2/internal/catch_template_test_registry.hpp:155:9: note: expanded from macro 'INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE'
  155 |         INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), Name, Tags, typename T,__VA_ARGS__)
      |         ^
../subprojects/Catch2-3.7.1/src/catch2/internal/catch_template_test_registry.hpp:143:17: note: expanded from macro 'INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2'
  143 |                 TestInit t;                                           \
      |                 ^
4 errors generated.
[531/609] Compiling C++ object subprojects/Catch2-3.7.1/tests/SelfTest.p/SelfTest_UsageTests_ToStringVariant.tests.cpp.o
ninja: build stopped: subcommand failed.
make: *** [build] Error 1
0 Answers