Patrick Palka 147e276b58 c++: class-scope qualified constrained auto [PR107188]
Here when parsing the class-scope auto constrained by a qualified
concept-id, we first tentatively parse the overall member-declaration as
a deprecated access-declaration, during which we parse C<int> as a
standalone TEMPLATE_ID_EXPR (separate from the auto) and end up emitting
the stray error

concepts-placeholder11.C:9:6: error: wrong number of template arguments (1, should be 2)
    9 |   N::C<int> auto f() { return 0; }
      |      ^~~~~~
concepts-placeholder11.C:5:34: note: provided for ‘template<class, class> concept N::C’
    5 |   template<class, class> concept C = true;
      |                                  ^

from build_concept_id called from cp_parser_template_id_expr.

We could fix this by adding a complain parameter to build_concept_id and
passing tf_none when parsing tentatively.  However, it seems this can
also be fixed in a more general way that might benefit non-concepts
code: when tentatively parsing an access-declaration, abort the parse
early if the qualifying scope isn't possibly a class or enumeration
type, so that we avoid parsing C<int> as a TEMPLATE_ID_EXPR here in the
first place.  This patch takes this latter approach.

	PR c++/107188

gcc/cp/ChangeLog:

	* parser.cc (cp_parser_using_declaration): Give up early if the
	scope of an access-declaration isn't possibly a class type.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp2a/concepts-placeholder11.C: New test.
2022-12-15 16:07:09 -05:00
2022-11-24 00:17:47 +00:00
2022-11-15 08:32:29 +00:00
2022-12-15 00:17:29 +00:00
2022-11-24 00:17:47 +00:00
2022-12-15 00:17:29 +00:00
2022-11-24 00:17:47 +00:00
2022-11-17 00:16:52 +00:00
2022-12-11 00:17:43 +00:00
2022-11-24 00:17:47 +00:00
2022-12-08 00:17:45 +00:00
2022-11-24 00:17:47 +00:00
2022-12-09 00:18:54 +00:00
2022-12-12 14:18:14 -08:00
2022-11-24 00:17:47 +00:00
2022-12-12 00:22:21 +00:00
2022-12-14 00:18:37 +00:00
2022-11-24 00:17:47 +00:00
2022-12-01 00:17:51 +00:00
2022-11-24 00:17:47 +00:00
2022-12-14 17:43:08 +00:00
2022-12-09 11:08:55 +01:00
2022-12-14 17:43:08 +00:00

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.
Description
No description provided
Readme 2.1 GiB
Languages
C++ 31.9%
C 31.3%
Ada 12%
D 6.5%
Go 6.4%
Other 11.5%