Issue 181166
Summary After #111711, compile errors in catch2
Labels new issue
Assignees
Reporter DimitryAndric
    After #111711 "Reland: [clang] Finish implementation of P0522", committed in `llvmorg-20-init-18924-g`28ad8978ee2 (@mizvekov, @cor3ntin, @Endilll) I am getting errors in the devel/catch port on FreeBSD. This is the 2.x branch of https://github.com/catchorg/Catch2/tree/v2.x. It uses some macro trickery to get a header-only test framework going, and after 28ad8978ee2 clang produces errors similar to:

```
/wrkdirs/usr/ports/devel/catch/work/Catch2-2.13.10/projects/SelfTest/UsageTests/Misc.tests.cpp:366:1: error: no matching function for call to 'get_wrapper'
  366 | TEMPLATE_PRODUCT_TEST_CASE("Product with differing arities", "[template][product]", std::tuple, (int, (int, double), (int, double, float))) {
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/wrkdirs/usr/ports/devel/catch/work/Catch2-2.13.10/include/catch.hpp:259:43: note: expanded from macro 'TEMPLATE_PRODUCT_TEST_CASE'
  259 | #define TEMPLATE_PRODUCT_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE( __VA_ARGS__ )
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/wrkdirs/usr/ports/devel/catch/work/Catch2-2.13.10/include/internal/catch_test_registry.h:226:9: note: expanded from macro 'INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE'
  226 | INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, typename T,__VA_ARGS__)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/wrkdirs/usr/ports/devel/catch/work/Catch2-2.13.10/include/internal/catch_test_registry.h:213:69: note: expanded from macro 'INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2'
  213 |                 using TestInit = typename create<TestName, decltype(get_wrapper<INTERNAL_CATCH_REMOVE_PARENS(TmplTypes)>(Catch::Detail::priority_tag<1>{})), TypeList<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(INTERNAL_CATCH_REMOVE_PARENS(TypesList))>>::type; \
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/wrkdirs/usr/ports/devel/catch/work/Catch2-2.13.10/projects/SelfTest/UsageTests/Misc.tests.cpp:366:1: note: candidate template ignored: substitution failure [with Cs = <std::tuple>]: conflicting deduction 'std::tuple' against 'type-parameter-0-0' for parameter
/wrkdirs/usr/ports/devel/catch/work/Catch2-2.13.10/include/catch.hpp:259:43: note: expanded from macro 'TEMPLATE_PRODUCT_TEST_CASE'
  259 | #define TEMPLATE_PRODUCT_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE( __VA_ARGS__ )
      | ^
/wrkdirs/usr/ports/devel/catch/work/Catch2-2.13.10/include/internal/catch_test_registry.h:226:9: note: expanded from macro 'INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE'
  226 | INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, typename T,__VA_ARGS__)
      | ^
/wrkdirs/usr/ports/devel/catch/work/Catch2-2.13.10/include/internal/catch_test_registry.h:199:13: note: expanded from macro 'INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2'
  199 |             INTERNAL_CATCH_TYPE_GEN \
      | ^
/wrkdirs/usr/ports/devel/catch/work/Catch2-2.13.10/include/internal/catch_preprocessor.hpp:117:20: note: expanded from macro 'INTERNAL_CATCH_TYPE_GEN'
  117 |     constexpr auto get_wrapper(Catch::Detail::priority_tag<1>) noexcept -> TemplateTypeList<Cs...> { return {}; }\
      | ^
/wrkdirs/usr/ports/devel/catch/work/Catch2-2.13.10/projects/SelfTest/UsageTests/Misc.tests.cpp:366:1: note: candidate template ignored: invalid explicitly-specified argument for template parameter 'Ts'
/wrkdirs/usr/ports/devel/catch/work/Catch2-2.13.10/include/catch.hpp:259:43: note: expanded from macro 'TEMPLATE_PRODUCT_TEST_CASE'
  259 | #define TEMPLATE_PRODUCT_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE( __VA_ARGS__ )
      | ^
/wrkdirs/usr/ports/devel/catch/work/Catch2-2.13.10/include/internal/catch_test_registry.h:226:9: note: expanded from macro 'INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE'
  226 | INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, typename T,__VA_ARGS__)
      | ^
/wrkdirs/usr/ports/devel/catch/work/Catch2-2.13.10/include/internal/catch_test_registry.h:199:13: note: expanded from macro 'INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2'
  199 |             INTERNAL_CATCH_TYPE_GEN \
      | ^
/wrkdirs/usr/ports/devel/catch/work/Catch2-2.13.10/include/internal/catch_preprocessor.hpp:114:20: note: expanded from macro 'INTERNAL_CATCH_TYPE_GEN'
  114 |     constexpr auto get_wrapper(Catch::Detail::priority_tag<1>) noexcept -> TypeList<Ts...> { return {}; }\
      |                    ^
```

Reduced test case, which compiles fine with clang 19, gcc 14 and 15, but not clang 20 after 28ad8978ee2:

```c++
#include <utility>
template <typename...> struct TypeList;
template <typename Ts> void get_wrapper();
template <template <typename...> class> struct TemplateTypeList;
template <template <typename...> class... Cs>
auto get_wrapper() -> TemplateTypeList<Cs...>;
template <typename...> struct append;
template <template <typename...> class, typename...> struct create;
template <typename T> struct append<T> {
  using type = T;
};
template <template <typename...> class Final,
          template <typename> class... Containers, typename... Types>
struct create<Final, TemplateTypeList<Containers...>, Types...> {
  using type = typename append<Final<>>::type;
};
template <typename...> struct INTERNAL_CATCH_UNIQUE_NAME {};
int INTERNAL_CATCH_UNIQUE_NAME0 = [] {
 using TestInit =
      typename create<INTERNAL_CATCH_UNIQUE_NAME,
 decltype(get_wrapper<std::tuple>()), TypeList<>>::type;
 TestInit();
  return 0;
}();
```


_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to