https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115656

--- Comment #2 from Sean Murthy <s.murthy at outlook dot com> ---
Compiler version: GCC 11.1 through GCC 14.1

Compiler options: -std=c++20 -Wall -Wextra -pedantic -pedantic-errors
-Werror=pedantic

Compiler output:

<source>: In function 'int main()':
<source>:39:13: error: class template argument deduction failed:
   39 |     A a2(45l); //Error GCC 11.1+: uncomment line above, the error
disappears
      |             ^
<source>:39:13: error: no matching function for call to 'A(long int)'
<source>:20:5: note: candidate: 'template<class U, template<class> class
requires  unsigned_integral< <template-parameter-2-1> > V, class S>  requires 
signed_integral<S> A(S)-> A<U, V>'
   20 |     A(S s) : u_( s < 0 ? -s : s) {}
      |     ^
<source>:20:5: note:   template argument deduction/substitution failed:
<source>: In substitution of 'template<class U, template<class> class requires 
unsigned_integral< <template-parameter-2-1> > V, class S>  requires 
signed_integral<S> A(S)-> A<U, V> [with U = unsigned int; V = dv; S = long
int]':
<source>:39:13:   required from here
   39 |     A a2(45l); //Error GCC 11.1+: uncomment line above, the error
disappears
      |             ^
<source>:20:5: error: template constraint failure for 'template<class U,
template<class> class requires  unsigned_integral< <template-parameter-2-1> >
V>  requires  unsigned_integral<U> struct A'
   20 |     A(S s) : u_( s < 0 ? -s : s) {}
      |     ^
<source>:20:5: note: constraints not satisfied
<source>:17:5: note: candidate: 'template<class U, template<class> class
requires  unsigned_integral< <template-parameter-2-1> > V> A(U)-> A<U, V>'
   17 |     A(U u) : u_(u) {};
      |     ^
<source>:17:5: note:   template argument deduction/substitution failed:
<source>:13:8: note: candidate: 'template<class U, template<class> class
requires  unsigned_integral< <template-parameter-2-1> > V> A(A<U, V>)-> A<U,
V>'
   13 | struct A
      |        ^
<source>:13:8: note:   template argument deduction/substitution failed:
<source>:39:13: note:   mismatched types 'A<U, V>' and 'long int'
   39 |     A a2(45l); //Error GCC 11.1+: uncomment line above, the error
disappears
      |             ^

Reply via email to