https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102184
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Status|UNCONFIRMED |NEW Last reconfirmed| |2021-09-03 Keywords| |rejects-valid Summary|Explicit template |Explicit template |instantiation is wrongly |instantiation thinks there |considered as |is an ambiguous template |specialization |specialization when there | |is none for concepts --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #1) > GCC is saying there is an ambigous specialization. > > If I do this, GCC accepts the code: > template<int N> requires(N==1) int fib() { return 1; } > template<int N> requires(N==2) int fib() { return 1; } > template<int N> int fib() requires(N!=1 && N!=2) { return fib<N-1>() + > fib<N-2>(); } > template int fib<1>(); But I think GCC does not know which specialization to instantiate here. Because the following works just fine: int t = fib<1>();