This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/48839] New: #error should terminate compilation - similar to missing #include
- From: "john.salmon at deshaw dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 1 May 2011 15:49:32 +0000
- Subject: [Bug c++/48839] New: #error should terminate compilation - similar to missing #include
- Auto-submitted: auto-generated
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: unassigned@gcc.gnu.org
ReportedBy: john.salmon@deshaw.com
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.