diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 309738cdbba..50659896501 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2011-12-31 Paolo Carlini + + PR c++/51397 + * semantics.c (finish_static_assert): Use %s instead of %E for + the error message. + 2011-12-27 Fabien ChĂȘne PR c++/23211 diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index bad418f97ca..835632fcfba 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -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"); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2fa96246442..b1b7e370588 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-12-31 Paolo Carlini + + PR c++/51397 + * g++.dg/cpp0x/static_assert6.C: New. + 2011-12-31 Uros Bizjak * 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 index 00000000000..d1ab0dded9d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/static_assert6.C @@ -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" }