public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/102184] New: Explicit template instantiation is wrongly considered as specialization
@ 2021-09-03  6:52 fchelnokov at gmail dot com
  2021-09-03  7:03 ` [Bug c++/102184] " pinskia at gcc dot gnu.org
  2021-09-03  7:07 ` [Bug c++/102184] Explicit template instantiation thinks there is an ambiguous template specialization when there is none for concepts pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: fchelnokov at gmail dot com @ 2021-09-03  6:52 UTC (permalink / raw)
  To: gcc-bugs

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-09-03  7:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-03  6:52 [Bug c++/102184] New: Explicit template instantiation is wrongly considered as specialization fchelnokov at gmail dot com
2021-09-03  7:03 ` [Bug c++/102184] " pinskia at gcc dot gnu.org
2021-09-03  7:07 ` [Bug c++/102184] Explicit template instantiation thinks there is an ambiguous template specialization when there is none for concepts pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).