Commit 51970b3e by Fabien Chêne

pt.c (check_template_variable): Check for the return of pedwarn before emitting a note.

2014-04-09  Fabien Chêne  <fabien@gcc.gnu.org>

	* pt.c (check_template_variable): Check for the return of pedwarn
	before emitting a note.
	* parser.c (cp_parser_lambda_introducer): Likewise.

From-SVN: r209252
parent dbe1eced
2014-04-09 Fabien Chêne <fabien@gcc.gnu.org>
* pt.c (check_template_variable): Check for the return of pedwarn
before emitting a note.
* parser.c (cp_parser_lambda_introducer): Likewise.
2014-04-08 Paolo Carlini <paolo.carlini@oracle.com> 2014-04-08 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/59115 PR c++/59115
......
...@@ -8961,10 +8961,10 @@ cp_parser_lambda_introducer (cp_parser* parser, tree lambda_expr) ...@@ -8961,10 +8961,10 @@ cp_parser_lambda_introducer (cp_parser* parser, tree lambda_expr)
if (VAR_P (capture_init_expr) if (VAR_P (capture_init_expr)
&& decl_storage_duration (capture_init_expr) != dk_auto) && decl_storage_duration (capture_init_expr) != dk_auto)
{ {
pedwarn (capture_token->location, 0, "capture of variable " if (pedwarn (capture_token->location, 0, "capture of variable "
"%qD with non-automatic storage duration", "%qD with non-automatic storage duration",
capture_init_expr); capture_init_expr))
inform (0, "%q+#D declared here", capture_init_expr); inform (0, "%q+#D declared here", capture_init_expr);
continue; continue;
} }
......
...@@ -2304,10 +2304,10 @@ check_template_variable (tree decl) ...@@ -2304,10 +2304,10 @@ check_template_variable (tree decl)
"%qD is not a static data member of a class template", decl); "%qD is not a static data member of a class template", decl);
else if (template_header_count > wanted) else if (template_header_count > wanted)
{ {
pedwarn (DECL_SOURCE_LOCATION (decl), 0, bool warned = pedwarn (DECL_SOURCE_LOCATION (decl), 0,
"too many template headers for %D (should be %d)", "too many template headers for %D (should be %d)",
decl, wanted); decl, wanted);
if (CLASSTYPE_TEMPLATE_SPECIALIZATION (ctx)) if (warned && CLASSTYPE_TEMPLATE_SPECIALIZATION (ctx))
inform (DECL_SOURCE_LOCATION (decl), inform (DECL_SOURCE_LOCATION (decl),
"members of an explicitly specialized class are defined " "members of an explicitly specialized class are defined "
"without a template header"); "without a template header");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment