This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/48839] New: #error should terminate compilation - similar to missing #include


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]