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

            Bug ID: 102184
           Summary: Explicit template instantiation is wrongly considered
                    as specialization
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fchelnokov at gmail dot com
  Target Milestone: ---

In this 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() { return fib<N-1>() + fib<N-2>(); }
template int fib<1>();
```
the last line with function explicit instantiation produces GCC error:
ambiguous template specialization 'fib<1>' for 'int fib()'

The other compilers are fine with the code: https://gcc.godbolt.org/z/fbMGs3hqY

Reply via email to