[Bug c++/102184] New: Explicit template instantiation is wrongly considered as specialization
fchelnokov at gmail dot com
gcc-bugzilla@gcc.gnu.org
Fri Sep 3 06:52:57 GMT 2021
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
More information about the Gcc-bugs
mailing list