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); } // namespace t6 } // namespace nttp_partial_order + +namespace nttp_inconsistent { + namespace t1 { + template struct X {}; + // expected-error@-1 {{conflicting deduction 'C' against 'int' for parameter}} + template class TT> struct Y {}; + // expected-note@-1 {{previous template template parameter is here}} + template struct Y; + // expected-note@-1 {{has different template parameters}} + } // namespace t1 + namespace t2 { + template struct X {}; + // expected-error@-1 {{conflicting deduction 'C' against 'int' for parameter}} + template class TT> struct Y {}; + // expected-note@-1 {{previous template template parameter is here}} + template struct Y; + // expected-note@-1 {{has different 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 class A> void f(A*) { 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 class TT> struct A { + static constexpr int value = TT::value; + }; + + template 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::value == 1); + // cxx17-error@-1 {{static assertion failed}} + // cxx17-note@-2 {{expression evaluates to '2 == 1'}} +} // namespace multiple_conversions +#endif