* [Bug c++/103198] ICE for requires requires clause with varadic templates
2021-11-11 18:38 [Bug c++/103198] New: ICE for requires requires clause with varadic templates unlvsur at live dot com
@ 2021-11-11 18:39 ` unlvsur at live dot com
2021-11-11 18:40 ` unlvsur at live dot com
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: unlvsur at live dot com @ 2021-11-11 18:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103198
--- Comment #1 from cqwrteur <unlvsur at live dot com> ---
Created attachment 51771
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51771&action=edit
Preprocess file
preprocess file
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/103198] ICE for requires requires clause with varadic templates
2021-11-11 18:38 [Bug c++/103198] New: ICE for requires requires clause with varadic templates unlvsur at live dot com
2021-11-11 18:39 ` [Bug c++/103198] " unlvsur at live dot com
@ 2021-11-11 18:40 ` unlvsur at live dot com
2021-11-11 19:46 ` ppalka at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: unlvsur at live dot com @ 2021-11-11 18:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103198
--- Comment #2 from cqwrteur <unlvsur at live dot com> ---
Created attachment 51772
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51772&action=edit
compiler error
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/103198] ICE for requires requires clause with varadic templates
2021-11-11 18:38 [Bug c++/103198] New: ICE for requires requires clause with varadic templates unlvsur at live dot com
2021-11-11 18:39 ` [Bug c++/103198] " unlvsur at live dot com
2021-11-11 18:40 ` unlvsur at live dot com
@ 2021-11-11 19:46 ` ppalka at gcc dot gnu.org
2021-11-19 0:32 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-11-11 19:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103198
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |rejects-valid
Target Milestone|--- |11.3
CC| |ppalka at gcc dot gnu.org
Last reconfirmed| |2021-11-11
Ever confirmed|0 |1
Assignee|unassigned at gcc dot gnu.org |ppalka at gcc dot gnu.org
Status|UNCONFIRMED |ASSIGNED
--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Reduced rejects-valid testcase:
template<class T>
struct A {
T handle;
template<class U>
requires requires { handle.f(); }
void f(U);
};
struct B { void f(); };
int main() {
A<B> a;
a.f(0);
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/103198] ICE for requires requires clause with varadic templates
2021-11-11 18:38 [Bug c++/103198] New: ICE for requires requires clause with varadic templates unlvsur at live dot com
` (2 preceding siblings ...)
2021-11-11 19:46 ` ppalka at gcc dot gnu.org
@ 2021-11-19 0:32 ` cvs-commit at gcc dot gnu.org
2021-12-15 19:55 ` cvs-commit at gcc dot gnu.org
2021-12-15 19:58 ` ppalka at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-19 0:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103198
--- Comment #4 from CVS 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:09c24fe42ff2cef3f3291f5a7540a5835c08430c
commit r12-5389-g09c24fe42ff2cef3f3291f5a7540a5835c08430c
Author: Patrick Palka <ppalka@redhat.com>
Date: Thu Nov 18 19:32:22 2021 -0500
c++: implicit dummy object in requires clause [PR103198]
In the testcase below satisfaction misbehaves for f and g ultimately
because find_template_parameters fails to notice that the constraint
'val.x' depends on the template parms of the class template. In
contrast, satisfaction works just fine for h.
The problem seems to come down to a difference in how any_template_parm_r
handles 'this' vs a dummy object: it walks the TREE_TYPE of the former
but not the latter, and this causes us to miss the tparm dependencies in
f/g's constraints since in their case the implicit object parm through
which we access 'val' is a dummy object. (For h, since we know it's a
non-static member function when parsing its trailing constraints, the
implicit object parm is 'this', not a dummy object.)
This patch fixes this inconsistency by making any_template_parm_r walk
into the TREE_TYPE of a dummy object, like it already does for 'this'.
PR c++/103198
gcc/cp/ChangeLog:
* pt.c (any_template_parm_r): Walk the TREE_TYPE of a dummy
object.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/concepts-this1.C: New test.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/103198] ICE for requires requires clause with varadic templates
2021-11-11 18:38 [Bug c++/103198] New: ICE for requires requires clause with varadic templates unlvsur at live dot com
` (3 preceding siblings ...)
2021-11-19 0:32 ` cvs-commit at gcc dot gnu.org
@ 2021-12-15 19:55 ` cvs-commit at gcc dot gnu.org
2021-12-15 19:58 ` ppalka at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-12-15 19:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103198
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Patrick Palka
<ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:648d5aa56abd2a0ab36403dd1e14dd225402301a
commit r11-9390-g648d5aa56abd2a0ab36403dd1e14dd225402301a
Author: Patrick Palka <ppalka@redhat.com>
Date: Thu Nov 18 19:32:22 2021 -0500
c++: implicit dummy object in requires clause [PR103198]
In the testcase below satisfaction misbehaves for f and g ultimately
because find_template_parameters fails to notice that the constraint
'val.x' depends on the template parms of the class template. In
contrast, satisfaction works just fine for h.
The problem seems to come down to a difference in how any_template_parm_r
handles 'this' vs a dummy object: it walks the TREE_TYPE of the former
but not the latter, and this causes us to miss the tparm dependencies in
f/g's constraints since in their case the implicit object parm through
which we access 'val' is a dummy object. (For h, since we know it's a
non-static member function when parsing its trailing constraints, the
implicit object parm is 'this', not a dummy object.)
This patch fixes this inconsistency by making any_template_parm_r walk
into the TREE_TYPE of a dummy object, like it already does for 'this'.
PR c++/103198
gcc/cp/ChangeLog:
* pt.c (any_template_parm_r): Walk the TREE_TYPE of a dummy
object.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/concepts-this1.C: New test.
(cherry picked from commit 09c24fe42ff2cef3f3291f5a7540a5835c08430c)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/103198] ICE for requires requires clause with varadic templates
2021-11-11 18:38 [Bug c++/103198] New: ICE for requires requires clause with varadic templates unlvsur at live dot com
` (4 preceding siblings ...)
2021-12-15 19:55 ` cvs-commit at gcc dot gnu.org
@ 2021-12-15 19:58 ` ppalka at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-12-15 19:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103198
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #6 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 11.3/12.
^ permalink raw reply [flat|nested] 7+ messages in thread