[Bug c++/96331] Class template argument deduction (CTAD) with Concepts
rs2740 at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Jul 30 04:37:27 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96331
TC <rs2740 at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rs2740 at gmail dot com
--- Comment #2 from TC <rs2740 at gmail dot com> ---
(In reply to Jonathan Wakely from comment #1)
> (In reply to Nicole from comment #0)
> > template<fixed_string NAME, typename TYPE>
>
> This is not valid. fixed_string is a class template, not a type and not a
> concept. So you can't use it as a template parameter.
>
> I don't think this is a bug.
It is a placeholder for a deduced class type, which is allowed by
[temp.param]/6.3.
The example can be reduced drastically:
template<int N = 0>
struct S { };
template<S>
concept C = true;
static_assert(C<S<0>{}>); // OK
template<S Value>
void f() requires C<Value> { // error
}
<source>:11:19: error: class template argument deduction failed:
11 | void f() requires C<Value> {
| ^~~~~~~~
<source>:11:19: error: no matching function for call to 'S(S<...auto...>)'
<source>:2:8: note: candidate: 'template<int N> S()-> S<N>'
2 | struct S {
| ^
<source>:2:8: note: template argument deduction/substitution failed:
<source>:11:19: note: candidate expects 0 arguments, 1 provided
11 | void f() requires C<Value> {
| ^~~~~~~~
<source>:2:8: note: candidate: 'template<int N> S(S<N>)-> S<N>'
2 | struct S {
| ^
<source>:2:8: note: template argument deduction/substitution failed:
<source>:11:19: note: mismatched types 'S<N>' and 'S<...auto...>'
11 | void f() requires C<Value> {
| ^~~~~~~~
Compiler returned: 1
More information about the Gcc-bugs
mailing list