Skip to content

Build Failure with clang++ 20 #2991

Open
@e-kwsm

Description

@e-kwsm

Describe the bug
Catch does not build with clang++ 20.

Expected behavior
Catch successfully builds.

Reproduction steps
Steps to reproduce the bug.

$ CXX=clang++ cmake -S . -B build -DCATCH_DEVELOPMENT_BUILD=ON
$ cmake --build build -- -k
[ 63%] Built target Catch2
[ 64%] Built target Catch2WithMain
[ 64%] Building CXX object tests/CMakeFiles/SelfTest.dir/SelfTest/UsageTests/Generators.tests.cpp.o
tests/SelfTest/UsageTests/Generators.tests.cpp:303:18: error: 'return' will never be executed [-Werror,-Wunreachable-code-return]
  303 |         return { new test_generator() };
      |                  ^~~~~~~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [tests/CMakeFiles/SelfTest.dir/build.make:653: tests/CMakeFiles/SelfTest.dir/SelfTest/UsageTests/Generators.tests.cpp.o] Error 1
[ 65%] Building CXX object tests/CMakeFiles/SelfTest.dir/SelfTest/UsageTests/Misc.tests.cpp.o
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))) {
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/catch2/../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__ )
      |                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/catch2/../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__)
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/catch2/../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; \
      |                                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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
src/catch2/../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__ )
      |                                               ^
src/catch2/../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__)
      |         ^
src/catch2/../catch2/internal/catch_template_test_registry.hpp:128:13: note: expanded from macro 'INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2'
  128 |             INTERNAL_CATCH_TYPE_GEN                                                  \
      |             ^
src/catch2/../catch2/internal/catch_preprocessor.hpp:108:20: note: expanded from macro 'INTERNAL_CATCH_TYPE_GEN'
  108 |     constexpr auto get_wrapper() noexcept -> TemplateTypeList<Cs...> { return {}; }\
      |                    ^
tests/SelfTest/UsageTests/Misc.tests.cpp:387:1: note: candidate template ignored: invalid explicitly-specified argument for template parameter 'Ts'
src/catch2/../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__ )
      |                                               ^
src/catch2/../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__)
      |         ^
src/catch2/../catch2/internal/catch_template_test_registry.hpp:128:13: note: expanded from macro 'INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2'
  128 |             INTERNAL_CATCH_TYPE_GEN                                                  \
      |             ^
src/catch2/../catch2/internal/catch_preprocessor.hpp:105:20: note: expanded from macro 'INTERNAL_CATCH_TYPE_GEN'
  105 |     constexpr auto get_wrapper() noexcept -> TypeList<Ts...> { return {}; }\
      |                    ^
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))) {
      | ^
src/catch2/../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__ )
      |                                               ^
src/catch2/../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__)
      |         ^
src/catch2/../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; \
      |                                           ^
tests/SelfTest/UsageTests/Misc.tests.cpp:387:1: error: expected ';' after alias declaration
src/catch2/../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__ )
      |                                               ^
src/catch2/../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__)
      |         ^
src/catch2/../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; \
      |                                                                                                                                                                                                                          ^
tests/SelfTest/UsageTests/Misc.tests.cpp:387:1: error: unknown type name 'TestInit'
src/catch2/../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__ )
      |                                               ^
src/catch2/../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__)
      |         ^
src/catch2/../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.
make[2]: *** [tests/CMakeFiles/SelfTest.dir/build.make:681: tests/CMakeFiles/SelfTest.dir/SelfTest/UsageTests/Misc.tests.cpp.o] Error 1
make[2]: Target 'tests/CMakeFiles/SelfTest.dir/build' not remade because of errors.
make[1]: *** [CMakeFiles/Makefile2:1121: tests/CMakeFiles/SelfTest.dir/all] Error 2
make[1]: Target 'all' not remade because of errors.
make: *** [Makefile:166: all] Error 2
make: Target 'default_target' not remade because of errors.

First error occurs at

return { new test_generator() };

which calls constructor that throws
[[noreturn]] explicit test_generator() {
// removing the following line will cause the program to terminate
// gracefully.
throw Catch::GeneratorException( "failure to init" );
}

Second error (#2981) occurs at

TEMPLATE_PRODUCT_TEST_CASE("Product with differing arities", "[template][product]", std::tuple, (int, (int, double), (int, double, float))) {
REQUIRE(std::tuple_size<TestType>::value >= 1);
}

Platform information:

  • OS: EndeavourOS
  • Compiler+version: clang++ 20.1.6
  • Catch version: 1de7d0e

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions