From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30336 invoked by alias); 3 Dec 2011 22:07:23 -0000 Received: (qmail 30326 invoked by uid 22791); 3 Dec 2011 22:07:23 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 03 Dec 2011 22:07:10 +0000 From: "dave@boost-consulting.com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/51397] New: static_assert message formatting Date: Sat, 03 Dec 2011 22:07:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: dave@boost-consulting.com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-12/txt/msg00278.txt.bz2 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!