https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71886
Bug ID: 71886
Summary: Incorrect error on operator() being an member in
template
Product: gcc
Version: 5.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: tomaszkam at gmail dot com
Target Milestone: ---
Following class correctly compiles without any error in GCC 5.1.0:
struct NonTemplate
{
typedef void type();
type operator(); //Actually declares an member function.
};
However in case of the class template:
template<typename T>
struct Template
{
typedef T type;
T operator();
};
Followinge error is generated:
error: declaration of 'operator()' as non-function
T operator();
Despite the fact that Template<void()> is identical to NonTemplate.