[Bug c++/83797] New: Inconsistent error messages for main
denis.campredon at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Jan 11 12:48:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83797
Bug ID: 83797
Summary: Inconsistent error messages for main
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: denis.campredon at gmail dot com
Target Milestone: ---
In the following snippet:
-------------
inline static constexpr short main() {
}
-------------
1 : <source>:1:36: error: cannot declare '::main' to be inline
inline static constexpr short main() {
^
1 : <source>:1:36: error: cannot declare '::main' to be 'constexpr'
1 : <source>:1:36: error: cannot declare '::main' to be static
1 : <source>:1:36: error: '::main' must return 'int'
-------------
'int' and 'constexpr' are quoted whereas 'inline' and 'static' are not.
In this one 'main' is not preceded by '::' whereas in all the previous warnings
it is.
------------
main() {}
------------
1 : <source>:1:6: warning: ISO C++ forbids declaration of 'main' with no type
[-Wreturn-type]
main(){}
^
------------
More information about the Gcc-bugs
mailing list