Title
Effect of ill-formedness resulting from #error
Status
c++23
Section
15.8 [cpp.error]
Submitter
Clark Nelson

Created on 2008-11-13.00:00:00 last changed 16 months ago

Messages

Date: 2023-02-12.18:08:04

[ Resolved by issue 2518, adopted in February, 2023. ]

C99 is very clear that a #error directive causes a translation to fail: Clause 4 paragraph 4 says,

The implementation shall not successfully translate a preprocessing translation unit containing a #error preprocessing directive unless it is part of a group skipped by conditional inclusion.

C++, on the other hand, simply says that a #error directive “renders the program ill-formed” (15.8 [cpp.error]), and the only requirement for an ill-formed program is that a diagnostic be issued; the translation may continue and succeed. (Noted in passing: if this difference between C99 and C++ is addressed, it would be helpful for synchronization purposes in other contexts as well to introduce the term “preprocessing translation unit.”)

See also issue 2518.

History
Date User Action Args
2023-07-16 13:00:43adminsetstatus: open -> c++23
2008-11-13 00:00:00admincreate