]> gcc.gnu.org Git - gcc.git/commit
c++: bogus error w/ tentative type parse of concept-id [PR98394]
authorPatrick Palka <ppalka@redhat.com>
Tue, 9 Nov 2021 14:09:43 +0000 (09:09 -0500)
committerPatrick Palka <ppalka@redhat.com>
Tue, 9 Nov 2021 14:09:43 +0000 (09:09 -0500)
commita22d910305a5232694ff48ead37a7f53e46b7202
treeec777e3f0d7206738003e4d6877153ef38463b46
parenta19f09cb03d7f69377e6d12162e5d6df78a82849
c++: bogus error w/ tentative type parse of concept-id [PR98394]

Here when tentatively parsing the if condition as a declaration, we try
to treat C<1> as the start of a constrained placeholder type, which we
quickly reject because C doesn't accept a type as its first argument.
But since we're parsing tentatively, we shouldn't emit an error in this
case.

In passing, also fix PR85846 by only overriding 'tentative' to false when
given a concept-name, and not also when given a concept-id that has an empty
argument list.

PR c++/98394
PR c++/85846

gcc/cp/ChangeLog:

* parser.c (cp_parser_placeholder_type_specifier): Declare
static.  Don't override tentative to false when tmpl is a
concept-id with empty argument list.  Don't emit a "does not
constrain a type" error when tentative.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/concepts-pr98394.C: New test.
* g++.dg/cpp2a/concepts-pr85846.C: New test.
gcc/cp/parser.c
gcc/testsuite/g++.dg/cpp2a/concepts-pr85846.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/concepts-pr98394.C [new file with mode: 0644]
This page took 0.079216 seconds and 6 git commands to generate.