http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48839
Summary: #error should terminate compilation - similar to
missing #include
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: c++
AssignedTo: [email protected]
ReportedBy: [email protected]
bug 15638 established the policy that a missing #include terminates a
compilation.
I would suggest that encountering an #error should be immediately fatal, in
just the same way, and for exactly the same reasons.
A specific use-case: I've used something autoconf-like to tell me whether
C++0x-style auto is supported. Then I write this in my source file:
#ifndef HAVE_CXX0X_AUTO
#error This file requires the auto feature of C++0x
#endif
// lots of code that uses auto.
When I compile it with -std=c++98, I get the initial error message, and then
thousands of lines of complaints about syntax errors in the rest of the file.
It would be far better to stop after the #error.