[Bug c++/105436] [13 Regression] parse error with >= operator expression in template argument list in C++14 mode since r13-40
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed May 4 16:02:00 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105436
--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:
https://gcc.gnu.org/g:79a1a01cbd0e4a491d7078783131e3f88ca7158d
commit r13-115-g79a1a01cbd0e4a491d7078783131e3f88ca7158d
Author: Marek Polacek <polacek@redhat.com>
Date: Fri Apr 29 17:03:41 2022 -0400
c++: parse error with >= in template argument list [PR105436]
This patch fixes an oversight whereby we treated >= as the end of
a template argument. This causes problems in C++14, because in
cp_parser_template_argument we go different ways for C++14 and C++17:
/* It must be a non-type argument. In C++17 any constant-expression is
allowed. */
if (cxx_dialect > cxx14)
goto general_expr;
so in this testcase in C++14 we get "N" as the template argument but in
C++17 it is the whole "N >= 5" expression. So in C++14 the remaining
">= 5" triggered the newly-added diagnostic.
PR c++/105436
gcc/cp/ChangeLog:
* parser.cc (cp_parser_next_token_ends_template_argument_p): Don't
return true for CPP_GREATER_EQ.
gcc/testsuite/ChangeLog:
* g++.dg/parse/template31.C: New test.
More information about the Gcc-bugs
mailing list