Add couple of auto_diagnostic_group in redeclare_class_template.

	PR c++/92440
	* pt.c (redeclare_class_template): Group couple of
	errors and inform messages with auto_diagnostic_group.
parent d3c00969
2020-01-28 Martin Liska <mliska@suse.cz> 2020-01-28 Martin Liska <mliska@suse.cz>
PR c++/92440 PR c++/92440
* pt.c (redeclare_class_template): Group couple of
errors and inform messages with auto_diagnostic_group.
2020-01-28 Martin Liska <mliska@suse.cz>
PR c++/92440
* pt.c (redeclare_class_template): Use inform * pt.c (redeclare_class_template): Use inform
for the second location. for the second location.
......
...@@ -6148,6 +6148,7 @@ redeclare_class_template (tree type, tree parms, tree cons) ...@@ -6148,6 +6148,7 @@ redeclare_class_template (tree type, tree parms, tree cons)
&& (TEMPLATE_PARM_PARAMETER_PACK (DECL_INITIAL (tmpl_parm)) && (TEMPLATE_PARM_PARAMETER_PACK (DECL_INITIAL (tmpl_parm))
!= TEMPLATE_PARM_PARAMETER_PACK (DECL_INITIAL (parm))))) != TEMPLATE_PARM_PARAMETER_PACK (DECL_INITIAL (parm)))))
{ {
auto_diagnostic_group d;
error ("template parameter %q+#D", tmpl_parm); error ("template parameter %q+#D", tmpl_parm);
inform (input_location, "redeclared here as %q#D", parm); inform (input_location, "redeclared here as %q#D", parm);
return false; return false;
...@@ -6159,6 +6160,7 @@ redeclare_class_template (tree type, tree parms, tree cons) ...@@ -6159,6 +6160,7 @@ redeclare_class_template (tree type, tree parms, tree cons)
tree p2 = TREE_VEC_ELT (parms, i); tree p2 = TREE_VEC_ELT (parms, i);
if (!template_parameter_constraints_equivalent_p (p1, p2)) if (!template_parameter_constraints_equivalent_p (p1, p2))
{ {
auto_diagnostic_group d;
error ("declaration of template parameter %q+#D with different " error ("declaration of template parameter %q+#D with different "
"constraints", parm); "constraints", parm);
inform (DECL_SOURCE_LOCATION (tmpl_parm), inform (DECL_SOURCE_LOCATION (tmpl_parm),
...@@ -6172,6 +6174,7 @@ redeclare_class_template (tree type, tree parms, tree cons) ...@@ -6172,6 +6174,7 @@ redeclare_class_template (tree type, tree parms, tree cons)
A template-parameter may not be given default arguments A template-parameter may not be given default arguments
by two different declarations in the same scope. */ by two different declarations in the same scope. */
auto_diagnostic_group d;
error_at (input_location, "redefinition of default argument for %q#D", parm); error_at (input_location, "redefinition of default argument for %q#D", parm);
inform (DECL_SOURCE_LOCATION (tmpl_parm), inform (DECL_SOURCE_LOCATION (tmpl_parm),
"original definition appeared here"); "original definition appeared here");
...@@ -6206,6 +6209,7 @@ redeclare_class_template (tree type, tree parms, tree cons) ...@@ -6206,6 +6209,7 @@ redeclare_class_template (tree type, tree parms, tree cons)
/* Two classes with different constraints declare different entities. */ /* Two classes with different constraints declare different entities. */
if (!cp_tree_equal (req1, req2)) if (!cp_tree_equal (req1, req2))
{ {
auto_diagnostic_group d;
error_at (input_location, "redeclaration %q#D with different " error_at (input_location, "redeclaration %q#D with different "
"constraints", tmpl); "constraints", tmpl);
inform (DECL_SOURCE_LOCATION (tmpl), inform (DECL_SOURCE_LOCATION (tmpl),
......
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