File tree Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -672,3 +672,22 @@ namespace nttp_partial_order {
672672 template void f<B>(B<nullptr >);
673673 } // namespace t6
674674} // namespace nttp_partial_order
675+
676+ namespace nttp_inconsistent {
677+ namespace t1 {
678+ template <class A , A B> struct X {};
679+ // expected-error@-1 {{conflicting deduction 'C' against 'int' for parameter}}
680+ template <template <class C , int D> class TT > struct Y {};
681+ // expected-note@-1 {{previous template template parameter is here}}
682+ template struct Y <X>;
683+ // expected-note@-1 {{has different template parameters}}
684+ } // namespace t1
685+ namespace t2 {
686+ template <class A , A B = 0 > struct X {};
687+ // expected-error@-1 {{conflicting deduction 'C' against 'int' for parameter}}
688+ template <template <class C > class TT > struct Y {};
689+ // expected-note@-1 {{previous template template parameter is here}}
690+ template struct Y <X>;
691+ // expected-note@-1 {{has different template parameters}}
692+ } // namespace t2
693+ } // namespace nttp_inconsistent
Original file line number Diff line number Diff line change @@ -168,3 +168,26 @@ namespace PR10147 {
168168 template <template <typename ...> class A > void f (A<int >*) { A<> a; } // expected-warning 0-1{{extension}}
169169 void g () { f ((A<>*)0 ); }
170170}
171+
172+ #if __cplusplus >= 201703L
173+ namespace multiple_conversions {
174+ constexpr int g = 1 ;
175+ struct Z {
176+ constexpr operator const int &() const { return g; }
177+ constexpr operator int () { return 2 ; }
178+ } z;
179+
180+ template <template <const int &> class TT > struct A {
181+ static constexpr int value = TT<z>::value;
182+ };
183+
184+ template <int I> struct B {
185+ static constexpr int value = I;
186+ };
187+ // FIXME: This should probably convert z to (const int &) first, then
188+ // convert that to int.
189+ static_assert (A<B>::value == 1 );
190+ // cxx17-error@-1 {{static assertion failed}}
191+ // cxx17-note@-2 {{expression evaluates to '2 == 1'}}
192+ } // namespace multiple_conversions
193+ #endif
You can’t perform that action at this time.
0 commit comments