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 optionally noexcept function of () returning int and
- (2.2)
aan optionally noexcept function of (int, pointer to pointer to char) returning int
[...]
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,
noexceptwasn't a part of a function type, so an implementation was required to acceptint main() noexcept {}orint main(int, char**) noexcept {}.In C++17 (via P0012R1),
noexceptwas made a part of type system, while the restriction of type ofmainwasn't correspondingly updated. As a result, an implementation may reject amainfunction that isnoexcept, which possibly breaks some programs.Per this example, MSVC, GCC, and Clang still support adding
noexcepttomain, 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
noexcepttomain, 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.