public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/110006] New: friend function template with NTTP and constraint doesn't match existing declaration
@ 2023-05-27 17:33 services+gccbugs at vasama dot org
2023-06-16 20:44 ` [Bug c++/110006] friend function template with " waffl3x at protonmail dot com
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: services+gccbugs at vasama dot org @ 2023-05-27 17:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110006
Bug ID: 110006
Summary: friend function template with NTTP and constraint
doesn't match existing declaration
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: services+gccbugs at vasama dot org
Target Milestone: ---
// https://godbolt.org/z/jWo6ve9fh
template<typename T>
class s;
template<typename T>
void constraint(s<T> const&, int&);
template<typename U, typename T2>
U function(s<T2> const x)
requires requires (U& u) { constraint(x, u); }
{
return {};
}
template<typename T>
class s
{
template<typename U, typename T2>
friend U function(s<T2> const x)
requires requires (U& u) { constraint(x, u); };
};
int f(s<int> q)
{
// error: call of overloaded 'function<int>(s<int>&)' is ambiguous
return function<int>(q);
}
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/110006] friend function template with constraint doesn't match existing declaration
2023-05-27 17:33 [Bug c++/110006] New: friend function template with NTTP and constraint doesn't match existing declaration services+gccbugs at vasama dot org
@ 2023-06-16 20:44 ` waffl3x at protonmail dot com
2023-07-10 6:20 ` [Bug c++/110006] [11/12/13/14 Regression] " pinskia at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: waffl3x at protonmail dot com @ 2023-06-16 20:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110006
waffl3x <waffl3x at protonmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |waffl3x at protonmail dot com
--- Comment #1 from waffl3x <waffl3x at protonmail dot com> ---
I am pretty certain Bug 110291 is a duplicate of this one
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/110006] [11/12/13/14 Regression] friend function template with constraint doesn't match existing declaration
2023-05-27 17:33 [Bug c++/110006] New: friend function template with NTTP and constraint doesn't match existing declaration services+gccbugs at vasama dot org
2023-06-16 20:44 ` [Bug c++/110006] friend function template with " waffl3x at protonmail dot com
@ 2023-07-10 6:20 ` pinskia at gcc dot gnu.org
2023-07-12 13:39 ` ppalka at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-10 6:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110006
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2023-07-10
Known to fail| |11.1.0
Ever confirmed|0 |1
Summary|friend function template |[11/12/13/14 Regression]
|with constraint doesn't |friend function template
|match existing declaration |with constraint doesn't
| |match existing declaration
Known to work| |10.4.0
Keywords| |needs-bisection
Status|UNCONFIRMED |NEW
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=110291
Target Milestone|--- |11.5
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to waffl3x from comment #1)
> I am pretty certain Bug 110291 is a duplicate of this one
It is at least related.
Confirmed.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/110006] [11/12/13/14 Regression] friend function template with constraint doesn't match existing declaration
2023-05-27 17:33 [Bug c++/110006] New: friend function template with NTTP and constraint doesn't match existing declaration services+gccbugs at vasama dot org
2023-06-16 20:44 ` [Bug c++/110006] friend function template with " waffl3x at protonmail dot com
2023-07-10 6:20 ` [Bug c++/110006] [11/12/13/14 Regression] " pinskia at gcc dot gnu.org
@ 2023-07-12 13:39 ` ppalka at gcc dot gnu.org
2024-01-12 13:56 ` rguenth at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-07-12 13:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110006
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ppalka at gcc dot gnu.org
Keywords|needs-bisection |
--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Started with r11-3261-gb28b621ac67bee
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/110006] [11/12/13/14 Regression] friend function template with constraint doesn't match existing declaration
2023-05-27 17:33 [Bug c++/110006] New: friend function template with NTTP and constraint doesn't match existing declaration services+gccbugs at vasama dot org
` (2 preceding siblings ...)
2023-07-12 13:39 ` ppalka at gcc dot gnu.org
@ 2024-01-12 13:56 ` rguenth at gcc dot gnu.org
2024-02-03 0:07 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-01-12 13:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110006
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2023-07-10 00:00:00 |2024-1-12
Priority|P3 |P2
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/110006] [11/12/13/14 Regression] friend function template with constraint doesn't match existing declaration
2023-05-27 17:33 [Bug c++/110006] New: friend function template with NTTP and constraint doesn't match existing declaration services+gccbugs at vasama dot org
` (3 preceding siblings ...)
2024-01-12 13:56 ` rguenth at gcc dot gnu.org
@ 2024-02-03 0:07 ` cvs-commit at gcc dot gnu.org
2024-02-03 0:11 ` [Bug c++/110006] [11/12/13 " ppalka at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-02-03 0:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110006
--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:686b5eb9c9ee623a604dde5c49fa11c23f384c62
commit r14-8770-g686b5eb9c9ee623a604dde5c49fa11c23f384c62
Author: Patrick Palka <ppalka@redhat.com>
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) <case REQUIRES_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 <jason@redhat.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/110006] [11/12/13 Regression] friend function template with constraint doesn't match existing declaration
2023-05-27 17:33 [Bug c++/110006] New: friend function template with NTTP and constraint doesn't match existing declaration services+gccbugs at vasama dot org
` (4 preceding siblings ...)
2024-02-03 0:07 ` cvs-commit at gcc dot gnu.org
@ 2024-02-03 0:11 ` ppalka at gcc dot gnu.org
2024-02-03 0:13 ` ppalka at gcc dot gnu.org
2024-04-15 15:33 ` [Bug c++/110006] [11/12 " ppalka at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2024-02-03 0:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110006
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[11/12/13/14 Regression] |[11/12/13 Regression]
|friend function template |friend function template
|with constraint doesn't |with constraint doesn't
|match existing declaration |match existing declaration
--- Comment #5 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 14 so far.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/110006] [11/12/13 Regression] friend function template with constraint doesn't match existing declaration
2023-05-27 17:33 [Bug c++/110006] New: friend function template with NTTP and constraint doesn't match existing declaration services+gccbugs at vasama dot org
` (5 preceding siblings ...)
2024-02-03 0:11 ` [Bug c++/110006] [11/12/13 " ppalka at gcc dot gnu.org
@ 2024-02-03 0:13 ` ppalka at gcc dot gnu.org
2024-04-15 15:33 ` [Bug c++/110006] [11/12 " ppalka at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2024-02-03 0:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110006
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |ppalka at gcc dot gnu.org
Status|NEW |ASSIGNED
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/110006] [11/12 Regression] friend function template with constraint doesn't match existing declaration
2023-05-27 17:33 [Bug c++/110006] New: friend function template with NTTP and constraint doesn't match existing declaration services+gccbugs at vasama dot org
` (6 preceding siblings ...)
2024-02-03 0:13 ` ppalka at gcc dot gnu.org
@ 2024-04-15 15:33 ` ppalka at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2024-04-15 15:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110006
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[11/12/13 Regression] |[11/12 Regression] friend
|friend function template |function template with
|with constraint doesn't |constraint doesn't match
|match existing declaration |existing declaration
--- Comment #6 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Now also backported for GCC 13.3 as r13-8608-g38c2679ff9330d and
r13-8609-g265f207a46bc38.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2024-04-15 15:33 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-27 17:33 [Bug c++/110006] New: friend function template with NTTP and constraint doesn't match existing declaration services+gccbugs at vasama dot org
2023-06-16 20:44 ` [Bug c++/110006] friend function template with " waffl3x at protonmail dot com
2023-07-10 6:20 ` [Bug c++/110006] [11/12/13/14 Regression] " pinskia at gcc dot gnu.org
2023-07-12 13:39 ` ppalka at gcc dot gnu.org
2024-01-12 13:56 ` rguenth at gcc dot gnu.org
2024-02-03 0:07 ` cvs-commit at gcc dot gnu.org
2024-02-03 0:11 ` [Bug c++/110006] [11/12/13 " ppalka at gcc dot gnu.org
2024-02-03 0:13 ` ppalka at gcc dot gnu.org
2024-04-15 15:33 ` [Bug c++/110006] [11/12 " ppalka at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).