From 32210fd616cd79ae540b9731e7efa9288ccc0b87 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Sat, 31 Dec 2011 17:29:30 +0000 Subject: [PATCH] re PR c++/51397 (static_assert message formatting) /cp 2011-12-31 Paolo Carlini PR c++/51397 * semantics.c (finish_static_assert): Use %s instead of %E for the error message. /testsuite 2011-12-31 Paolo Carlini PR c++/51397 * g++.dg/cpp0x/static_assert6.C: New. From-SVN: r182757 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/semantics.c | 2 +- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/cpp0x/static_assert6.C | 4 ++++ 4 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/static_assert6.C 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" }