[Bug c++/100739] New: Definition of function template doesn't match declaration
raffael at casagrande dot ch
gcc-bugzilla@gcc.gnu.org
Mon May 24 09:15:21 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100739
Bug ID: 100739
Summary: Definition of function template doesn't match
declaration
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: raffael at casagrande dot ch
Target Milestone: ---
The following code fails to compile with the newest gcc (gcc 12.0.0 20210523):
-----------------------------
#include <concepts>
#include <array>
template <class T>
requires std::integral<T> using debug_t = T;
template<std::integral T>
struct X {
auto operator()(std::integral auto const& i) const ->
std::array<debug_t<decltype(i)>,1>;
};
template<std::integral T>
auto X<T>::operator()(std::integral auto const& i) const ->
std::array<debug_t<decltype(i)>,1>{
};
--------------------------
The error message is:
--------------------------
<source>:13:6: error: no declaration matches 'std::array<debug_t<decltype (i)>,
1> X<T>::operator()(const auto:4&) const'
13 | auto X<T>::operator()(std::integral auto const& i) const ->
std::array<debug_t<decltype(i)>,1>{
| ^~~~
<source>:9:8: note: candidate is: 'template<class T> template<class auto:3>
requires integral<auto:3> std::array<debug_t<decltype (i)>, 1>
X<T>::operator()(const auto:3&) const'
9 | auto operator()(std::integral auto const& i) const ->
std::array<debug_t<decltype(i)>,1>;
| ^~~~~~~~
<source>:8:8: note: 'struct X<T>' defined here
8 | struct X {
| ^
--------------------------
If we further simplify the code in one of the following ways, the problem
disappears:
1) If we remove the `std::array<...>`
2) If we remove the requires clause in the definition of debug_t
More information about the Gcc-bugs
mailing list