re PR c++/51397 (static_assert message formatting)
authorPaolo Carlini <paolo.carlini@oracle.com>
Sat, 31 Dec 2011 17:29:30 +0000 (17:29 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Sat, 31 Dec 2011 17:29:30 +0000 (17:29 +0000)
/cp
2011-12-31  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/51397
* semantics.c (finish_static_assert): Use %s instead of %E for
the error message.

/testsuite
2011-12-31  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/51397
* g++.dg/cpp0x/static_assert6.C: New.

From-SVN: r182757

gcc/cp/ChangeLog
gcc/cp/semantics.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/static_assert6.C [new file with mode: 0644]

index 309738cdbbaa4b30a01a4b067dd08a997b3707b6..50659896501c208cfff08538aa82ea9c3f77b87a 100644 (file)
@@ -1,3 +1,9 @@
+2011-12-31  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/51397
+       * semantics.c (finish_static_assert): Use %s instead of %E for
+       the error message.
+
 2011-12-27  Fabien ChĂȘne  <fabien@gcc.gnu.org>
 
        PR c++/23211
index bad418f97ca50c9ed03e4f98d9eb255a47e039b8..835632fcfbaf1a42330bb4160508b7195ef8e5cd 100644 (file)
@@ -5127,7 +5127,7 @@ finish_static_assert (tree condition, tree message, location_t location,
       if (TREE_CODE (condition) == INTEGER_CST 
           && integer_zerop (condition))
         /* Report the error. */
-        error ("static assertion failed: %E", message);
+        error ("static assertion failed: %s", TREE_STRING_POINTER (message));
       else if (condition && condition != error_mark_node)
        {
          error ("non-constant condition for static assertion");
index 2fa962464420193436c1786840d2da43031f6505..b1b7e3705880f7781fd6bbee779dec67a6ffdf73 100644 (file)
@@ -1,3 +1,8 @@
+2011-12-31  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/51397
+       * g++.dg/cpp0x/static_assert6.C: New.
+
 2011-12-31  Uros Bizjak  <ubizjak@gmail.com>
 
        * gcc.dg/tree-ssa/vrp47: Pass -march=i586 for ia32 target.
diff --git a/gcc/testsuite/g++.dg/cpp0x/static_assert6.C b/gcc/testsuite/g++.dg/cpp0x/static_assert6.C
new file mode 100644 (file)
index 0000000..d1ab0dd
--- /dev/null
@@ -0,0 +1,4 @@
+// PR c++/51397
+// { dg-options "-std=c++0x" }
+
+static_assert('X' != '\130', "'X' has the wrong value"); // { dg-error "'X' has the wrong value" }