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++/51397] New: static_assert message formatting


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51397

             Bug #: 51397
           Summary: static_assert message formatting
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: dave@boost-consulting.com


I just noticed that GCC can be overly-helpful ;-) when formatting a
static assertion message:

    static_assert('X' != '\130',"'X' has the wrong value");

gives me

    error: static assertion failed: "\'X\' has the wrong value"

I suggest that GCC should drop the surrounding quotes and not try to
escape any characters in the message.  Otherwise, things like

    #define static_assert_(x) static_assert(x, #x)
    static_assert_('X' != '\130')

turn out quite badly.

The point of this facility is, after all, to help programmers report legible
errors!


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