Author: Matheus Izvekov Date: 2025-09-23T05:30:09Z New Revision: 15f05dc135049ad125f19604508a51b50402f9d4
URL: https://github.com/llvm/llvm-project/commit/15f05dc135049ad125f19604508a51b50402f9d4 DIFF: https://github.com/llvm/llvm-project/commit/15f05dc135049ad125f19604508a51b50402f9d4.diff LOG: [clang] NFC: add a few template template parameter test cases (#160230) I also posted these on the core reflector today. Added: Modified: clang/test/SemaTemplate/cwg2398.cpp clang/test/SemaTemplate/temp_arg_template.cpp Removed: ################################################################################ diff --git a/clang/test/SemaTemplate/cwg2398.cpp b/clang/test/SemaTemplate/cwg2398.cpp index 06333c81a603e..315fa952932c5 100644 --- a/clang/test/SemaTemplate/cwg2398.cpp +++ b/clang/test/SemaTemplate/cwg2398.cpp @@ -672,3 +672,22 @@ namespace nttp_partial_order { template void f<B>(B<nullptr>); } // namespace t6 } // namespace nttp_partial_order + +namespace nttp_inconsistent { + namespace t1 { + template<class A, A B> struct X {}; + // expected-error@-1 {{conflicting deduction 'C' against 'int' for parameter}} + template<template<class C, int D> class TT> struct Y {}; + // expected-note@-1 {{previous template template parameter is here}} + template struct Y<X>; + // expected-note@-1 {{has diff erent template parameters}} + } // namespace t1 + namespace t2 { + template<class A, A B = 0> struct X {}; + // expected-error@-1 {{conflicting deduction 'C' against 'int' for parameter}} + template<template<class C> class TT> struct Y {}; + // expected-note@-1 {{previous template template parameter is here}} + template struct Y<X>; + // expected-note@-1 {{has diff erent template parameters}} + } // namespace t2 +} // namespace nttp_inconsistent diff --git a/clang/test/SemaTemplate/temp_arg_template.cpp b/clang/test/SemaTemplate/temp_arg_template.cpp index c9576e2057e53..73fa57beebe11 100644 --- a/clang/test/SemaTemplate/temp_arg_template.cpp +++ b/clang/test/SemaTemplate/temp_arg_template.cpp @@ -168,3 +168,26 @@ namespace PR10147 { template<template<typename...> class A> void f(A<int>*) { A<> a; } // expected-warning 0-1{{extension}} void g() { f((A<>*)0); } } + +#if __cplusplus >= 201703L +namespace multiple_conversions { + constexpr int g = 1; + struct Z { + constexpr operator const int&() const { return g; } + constexpr operator int() { return 2; } + } z; + + template<template<const int&> class TT> struct A { + static constexpr int value = TT<z>::value; + }; + + template<int I> struct B { + static constexpr int value = I; + }; + // FIXME: This should probably convert z to (const int &) first, then + // convert that to int. + static_assert(A<B>::value == 1); + // cxx17-error@-1 {{static assertion failed}} + // cxx17-note@-2 {{expression evaluates to '2 == 1'}} +} // namespace multiple_conversions +#endif _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
