-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Full name of submitter (unless configured in github; will be published with the issue): Jiang An
Reference (section label): [basic.start.main]
Link to reflector thread (if any):
Issue description:
In C++11/14, noexcept
wasn't a part of a function type, so an implementation was required to accept int main() noexcept {}
or int main(int, char**) noexcept {}
.
In C++17 (via P0012R1), noexcept
was made a part of type system, while the restriction of type of main
wasn't correspondingly updated. As a result, an implementation may reject a main
function that is noexcept
, which possibly breaks some programs.
Per this example, MSVC, GCC, and Clang still support adding noexcept
to main
, while EDG (and deprecated ICC) diagnoses it. However, EDG (and ICC) also emit such diagnostic in C++14 mode, which isn't so conforming.
If it is intended to support adding noexcept
to main
, perhaps we should change [basic.start.main] p2 correspondingly. Otherwise, I think we should add an entry to Annex C.
Suggested resolution:
(for supporting adding noexcept
)
Modify [basic.start.main] as indicated.
[...]
- (2.1)
aan optionallynoexcept
function of()
returningint
and- (2.2)
aan optionallynoexcept
function of(int
, pointer to pointer tochar)
returningint
[...]