[Bug c++/112769] [11/12/13/14 Regression] ICE on valid code related to requires-expression

2024-02-02 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112769

--- Comment #4 from GCC Commits  ---
The master branch has been updated by Patrick Palka :

https://gcc.gnu.org/g:686b5eb9c9ee623a604dde5c49fa11c23f384c62

commit r14-8770-g686b5eb9c9ee623a604dde5c49fa11c23f384c62
Author: Patrick Palka 
Date:   Fri Feb 2 19:07:08 2024 -0500

c++: requires-exprs and partial constraint subst [PR110006]

In r11-3261-gb28b621ac67bee we made tsubst_requires_expr never partially
substitute into a requires-expression so as to avoid checking its
requirements out of order during e.g. generic lambda regeneration.

These PRs however illustrate that we still sometimes do need to
partially substitute into a requires-expression, in particular when it
appears in associated constraints that we're directly substituting for
sake of declaration matching or dguide constraint rewriting.  In these
cases we're being called from tsubst_constraint during which
processing_constraint_expression_p is true, so this patch checks this
predicate to control whether we defer substitution or partially
substitute.

In turn, we now need to propagate semantic tsubst flags through
tsubst_requires_expr rather than just using tf_none, notably for sake of
dguide constraint rewriting which sets tf_dguide.

PR c++/110006
PR c++/112769

gcc/cp/ChangeLog:

* constraint.cc (subst_info::quiet): Accomodate non-diagnostic
tsubst flags.
(tsubst_valid_expression_requirement): Likewise.
(tsubst_simple_requirement): Return a substituted _REQ node when
processing_template_decl.
(tsubst_type_requirement_1): Accomodate non-diagnostic tsubst
flags.
(tsubst_type_requirement): Return a substituted _REQ node when
processing_template_decl.
(tsubst_compound_requirement): Likewise.  Accomodate non-diagnostic
tsubst flags.
(tsubst_nested_requirement): Likewise.
(tsubst_requires_expr): Don't defer partial substitution when
processing_constraint_expression_p is true, in which case return
a substituted REQUIRES_EXPR.
* pt.cc (tsubst_expr) : Accomodate
non-diagnostic tsubst flags.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/class-deduction-alias18.C: New test.
* g++.dg/cpp2a/concepts-friend16.C: New test.

Reviewed-by: Jason Merrill 

[Bug c++/112769] [11/12/13/14 Regression] ICE on valid code related to requires-expression

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

Patrick Palka  changed:

   What|Removed |Added

   See Also|https://gcc.gnu.org/bugzill |
   |a/show_bug.cgi?id=111222|
 CC||stevenxia990430 at gmail dot 
com

--- Comment #3 from Patrick Palka  ---
*** Bug 111222 has been marked as a duplicate of this bug. ***

[Bug c++/112769] [11/12/13/14 Regression] ICE on valid code related to requires-expression

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

Patrick Palka  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
 CC||ppalka at gcc dot gnu.org
Summary|ICE on valid code related   |[11/12/13/14 Regression]
   |to requires-expression  |ICE on valid code related
   ||to requires-expression
 Ever confirmed|0   |1
   Last reconfirmed||2024-02-02
   Assignee|unassigned at gcc dot gnu.org  |ppalka at gcc dot 
gnu.org
   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=101181
   Target Milestone|--- |11.5
  Known to work||11.1.0
  Known to fail||11.4.0, 12.3.0, 13.2.0,
   ||14.0

--- Comment #2 from Patrick Palka  ---
Confirmed, we started ICEing with a non-checking compiler after r12- /
r11-8734.