This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

C++ PATCHes to dependent template-id parsing


81204 is a regression whereby previously we would accidentally get the
parsing of res.template set<I> right because when we did the lookup in
the surrounding context, we found the function template and then
ignored it.  This patch partially reverts the handling of .template to
how it was in GCC 6.

But this bug is really a special case of 54769; we should be treating
that name as dependent and not doing a lookup in the enclosing context
at all.  As I noted in discussion of 55576, we need to pass
template_keyword_p into nested_name_specifier_opt.  So this patch does
that, and also adjusts cp_parser_template_name to consider object
scope.

With that change, we see TEMPLATE_ID_EXPR in more error cases, so I
adjusted cp_parser_template_id to use the range on those expression
nodes as well as on the replacement token.

45976 and 55639 are cases where we gave unhelpful diagnostics for uses
of ::template that are pedantically ill-formed, but harmless and
accepted by other compilers.  So these patches fix G++ to accept them
with a pedwarn.

Tested x86_64-pc-linux-gnu, applying to trunk.  81204 also to 7.

Attachment: 81204.diff
Description: Text document

Attachment: 54769.diff
Description: Text document

Attachment: tid-loc.diff
Description: Text document

Attachment: 45976.diff
Description: Text document

Attachment: 55639.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]