re PR c++/51397 (static_assert message formatting)

/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
This commit is contained in:
Paolo Carlini 2011-12-31 17:29:30 +00:00 committed by Paolo Carlini
parent 553fb1c201
commit 32210fd616
4 changed files with 16 additions and 1 deletions

View 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

View 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");

View 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.

View File

@ -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" }