Skip to content

Commit 41f071a

Browse files
committed
c++: improve nesting in print_z_candidate [PR121966]
Comment #2 of PR c++/121966 notes that the "inherited here" messages should be nested *within* the note they describe. Implemented by this patch, which also nests other notes emitted for rejection_reason within the first note of print_z_candidate. gcc/cp/ChangeLog: PR c++/121966 * call.cc (print_z_candidate): Consolidate instances of auto_diagnostic_nesting_level into one, above the "inherited here" message so that any such message is nested within the note, and any messages emitted due to the switch on rejection_reason are similarly nested within the note. Signed-off-by: David Malcolm <[email protected]>
1 parent c0b21d1 commit 41f071a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

gcc/cp/call.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4104,15 +4104,18 @@ print_z_candidate (location_t loc, const char *msgstr,
41044104
inform (cloc, "%s%#qD (rewritten)", msg, fn);
41054105
else
41064106
inform (cloc, "%s%#qD", msg, fn);
4107+
4108+
auto_diagnostic_nesting_level sentinel;
4109+
41074110
if (fn != candidate->fn)
41084111
{
41094112
cloc = location_of (candidate->fn);
41104113
inform (cloc, "inherited here");
41114114
}
4115+
41124116
/* Give the user some information about why this candidate failed. */
41134117
if (candidate->reason != NULL)
41144118
{
4115-
auto_diagnostic_nesting_level sentinel;
41164119
struct rejection_reason *r = candidate->reason;
41174120

41184121
switch (r->code)
@@ -4172,10 +4175,7 @@ print_z_candidate (location_t loc, const char *msgstr,
41724175
"class type is invalid");
41734176
break;
41744177
case rr_constraint_failure:
4175-
{
4176-
auto_diagnostic_nesting_level sentinel;
4177-
diagnose_constraints (cloc, fn, NULL_TREE);
4178-
}
4178+
diagnose_constraints (cloc, fn, NULL_TREE);
41794179
break;
41804180
case rr_inherited_ctor:
41814181
inform (cloc, "an inherited constructor is not a candidate for "

0 commit comments

Comments
 (0)