https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86652
Bug ID: 86652 Summary: pointer to function type cannot have 'const' qualifier Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: zhonghao at pku dot org.cn Target Milestone: --- The code is as follow: class C { public: template <typename i> int (*f())() const; }; g++ accepts the code, but clang++ rejects it: code4.cpp:4:7: error: pointer to function type cannot have 'const' qualifier int (*f())() const; ^ 1 error generated. If it's a pointer to a const function, the line shall be: int (*f() const)(); If the return type is const (which is of course meaningless), the line shall be: const int (*f())(); However, I do not quite understant int (*f())() const;. Maybe it is illegal as clang++ says?