[Bug c++/107188] using concept type-constraint declared in nested namespace causes incorrect compilation error

2024-03-08 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107188

Patrick Palka  changed:

   What|Removed |Added

 Resolution|--- |FIXED
   Target Milestone|--- |13.0
 Status|ASSIGNED|RESOLVED

--- Comment #3 from Patrick Palka  ---
Fixed in GCC 13

[Bug c++/107188] using concept type-constraint declared in nested namespace causes incorrect compilation error

2022-12-15 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107188

--- Comment #2 from CVS Commits  ---
The master branch has been updated by Patrick Palka :

https://gcc.gnu.org/g:147e276b580b674a46bc3b9c461ae7837fd48aba

commit r13-4731-g147e276b580b674a46bc3b9c461ae7837fd48aba
Author: Patrick Palka 
Date:   Thu Dec 15 16:07:09 2022 -0500

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 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 auto f() { return 0; }
  |  ^~
concepts-placeholder11.C:5:34: note: provided for âtemplate
concept N::Câ
5 |   template 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 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.

[Bug c++/107188] using concept type-constraint declared in nested namespace causes incorrect compilation error

2022-10-10 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107188

Patrick Palka  changed:

   What|Removed |Added

   Assignee|unassigned at gcc dot gnu.org  |ppalka at gcc dot 
gnu.org
 CC||ppalka at gcc dot gnu.org
   Last reconfirmed||2022-10-10
 Ever confirmed|0   |1
 Status|UNCONFIRMED |ASSIGNED

--- Comment #1 from Patrick Palka  ---
Confirmed, not a regression.  Reduced:

namespace N {
  template concept C = true;
}

struct X {
  N::C auto f() { return 0; }
};