[Bug c++/90797] New: gcc reject valid code
zhonghao at pku dot org.cn
gcc-bugzilla@gcc.gnu.org
Sun Jun 9 08:44:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90797
Bug ID: 90797
Summary: gcc reject valid code
Product: gcc
Version: 10.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: ---
My gcc is 10.0.0, and my code is:
class a {
public:
int b(int a());
};
int x();
void y() {
a z; z.b(x);
}
The error message is:
<source>:3:8: error: return type specification for constructor invalid
3 | int b(int a());
| ^~~
<source>: In function 'void y()':
<source>:7:11: error: invalid conversion from 'int (*)()' to 'void (*)()'
[-fpermissive]
7 | a z; z.b(x);
| ^
| |
| int (*)()
<source>:3:12: note: initializing argument 1 of 'int a::b(void (*)())'
3 | int b(int a());
| ~~~~^~~
Compiler returned: 1
clang, icc, and msvc all accept the code.
More information about the Gcc-bugs
mailing list