* [Bug c++/95451] [8/9/10 regression] ICE for lambda capturing this and calling operator()
2020-05-31 14:33 [Bug c++/95451] New: [8/9/10 regression] ICE for lambda capturing this and calling operator() max.kanold@nu-cost.com
@ 2020-05-31 14:39 ` max.kanold@nu-cost.com
2020-06-01 8:36 ` [Bug c++/95451] [8/9/10 regression] ICE for lambda capturing this and calling operator() since r8-2720-gf44a8dd56f5bfbd0 marxin at gcc dot gnu.org
` (15 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: max.kanold@nu-cost.com @ 2020-05-31 14:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95451
--- Comment #1 from Max <max.kanold@nu-cost.com> ---
I just noted this is a duplicate of
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90480, although the other bug
report neither mentions the workaround nor 86594. I guess I need to improve my
search skills :/
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug c++/95451] [8/9/10 regression] ICE for lambda capturing this and calling operator() since r8-2720-gf44a8dd56f5bfbd0
2020-05-31 14:33 [Bug c++/95451] New: [8/9/10 regression] ICE for lambda capturing this and calling operator() max.kanold@nu-cost.com
2020-05-31 14:39 ` [Bug c++/95451] " max.kanold@nu-cost.com
@ 2020-06-01 8:36 ` marxin at gcc dot gnu.org
2020-06-02 7:32 ` [Bug c++/95451] [8/9/10/11 " rguenth at gcc dot gnu.org
` (14 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-06-01 8:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95451
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org,
| |marxin at gcc dot gnu.org
Status|UNCONFIRMED |NEW
Summary|[8/9/10 regression] ICE for |[8/9/10 regression] ICE for
|lambda capturing this and |lambda capturing this and
|calling operator() |calling operator() since
| |r8-2720-gf44a8dd56f5bfbd0
Keywords| |ice-on-valid-code
Ever confirmed|0 |1
Last reconfirmed| |2020-06-01
--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed, started with r8-2720-gf44a8dd56f5bfbd0.
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug c++/95451] [8/9/10/11 regression] ICE for lambda capturing this and calling operator() since r8-2720-gf44a8dd56f5bfbd0
2020-05-31 14:33 [Bug c++/95451] New: [8/9/10 regression] ICE for lambda capturing this and calling operator() max.kanold@nu-cost.com
2020-05-31 14:39 ` [Bug c++/95451] " max.kanold@nu-cost.com
2020-06-01 8:36 ` [Bug c++/95451] [8/9/10 regression] ICE for lambda capturing this and calling operator() since r8-2720-gf44a8dd56f5bfbd0 marxin at gcc dot gnu.org
@ 2020-06-02 7:32 ` rguenth at gcc dot gnu.org
2021-01-14 8:56 ` rguenth at gcc dot gnu.org
` (13 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-06-02 7:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95451
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |8.5
Summary|[8/9/10 regression] ICE for |[8/9/10/11 regression] ICE
|lambda capturing this and |for lambda capturing this
|calling operator() since |and calling operator()
|r8-2720-gf44a8dd56f5bfbd0 |since
| |r8-2720-gf44a8dd56f5bfbd0
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug c++/95451] [8/9/10/11 regression] ICE for lambda capturing this and calling operator() since r8-2720-gf44a8dd56f5bfbd0
2020-05-31 14:33 [Bug c++/95451] New: [8/9/10 regression] ICE for lambda capturing this and calling operator() max.kanold@nu-cost.com
` (2 preceding siblings ...)
2020-06-02 7:32 ` [Bug c++/95451] [8/9/10/11 " rguenth at gcc dot gnu.org
@ 2021-01-14 8:56 ` rguenth at gcc dot gnu.org
2021-02-25 11:51 ` jakub at gcc dot gnu.org
` (12 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-01-14 8:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95451
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Bisected to a different rev, so maybe not a dup after all.
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug c++/95451] [8/9/10/11 regression] ICE for lambda capturing this and calling operator() since r8-2720-gf44a8dd56f5bfbd0
2020-05-31 14:33 [Bug c++/95451] New: [8/9/10 regression] ICE for lambda capturing this and calling operator() max.kanold@nu-cost.com
` (3 preceding siblings ...)
2021-01-14 8:56 ` rguenth at gcc dot gnu.org
@ 2021-02-25 11:51 ` jakub at gcc dot gnu.org
2021-02-25 16:15 ` jakub at gcc dot gnu.org
` (11 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-02-25 11:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95451
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
We indeed ICE on:
struct A {
template<typename>
void foo() {
[this](auto) { operator()(); }(0);
}
void operator()() {}
};
int main() {
A{}.foo<void>();
}
accept:
struct A {
template<typename>
void foo() {
[this](int) { operator()(); }(0);
}
void operator()() {}
};
int main() {
A{}.foo<int>();
}
and reject:
struct A {
void foo() {
[this](auto) { operator()(); }(0);
}
void operator()() {}
};
int main() {
A{}.foo();
}
while clang++ accepts all 3. With this->operator()() instead of operator()()
all 3 are accepted too indeed.
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug c++/95451] [8/9/10/11 regression] ICE for lambda capturing this and calling operator() since r8-2720-gf44a8dd56f5bfbd0
2020-05-31 14:33 [Bug c++/95451] New: [8/9/10 regression] ICE for lambda capturing this and calling operator() max.kanold@nu-cost.com
` (4 preceding siblings ...)
2021-02-25 11:51 ` jakub at gcc dot gnu.org
@ 2021-02-25 16:15 ` jakub at gcc dot gnu.org
2021-02-26 9:44 ` cvs-commit at gcc dot gnu.org
` (10 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-02-25 16:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95451
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 50256
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50256&action=edit
gcc11-pr95451.patch
Untested fix.
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug c++/95451] [8/9/10/11 regression] ICE for lambda capturing this and calling operator() since r8-2720-gf44a8dd56f5bfbd0
2020-05-31 14:33 [Bug c++/95451] New: [8/9/10 regression] ICE for lambda capturing this and calling operator() max.kanold@nu-cost.com
` (5 preceding siblings ...)
2021-02-25 16:15 ` jakub at gcc dot gnu.org
@ 2021-02-26 9:44 ` cvs-commit at gcc dot gnu.org
2021-02-26 9:48 ` [Bug c++/95451] [8/9/10 " jakub at gcc dot gnu.org
` (9 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-02-26 9:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95451
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:27f9a87886d48448f83e0e559dcf028b1a4a4ec6
commit r11-7418-g27f9a87886d48448f83e0e559dcf028b1a4a4ec6
Author: Jakub Jelinek <jakub@redhat.com>
Date: Fri Feb 26 10:43:28 2021 +0100
c++: Fix operator() lookup in lambdas [PR95451]
During name lookup, name-lookup.c uses:
if (!(!iter->type && HIDDEN_TYPE_BINDING_P (iter))
&& (bool (want & LOOK_want::HIDDEN_LAMBDA)
|| !is_lambda_ignored_entity (iter->value))
&& qualify_lookup (iter->value, want))
binding = iter->value;
Unfortunately as the following testcase shows, this doesn't work in
generic lambdas, where we on the auto b = ... lambda ICE and on the
auto d = lambda reject it even when it should be valid. The problem
is that the binding doesn't have a FUNCTION_DECL with
LAMBDA_FUNCTION_P for the operator(), but an OVERLOAD with
TEMPLATE_DECL for such FUNCTION_DECL.
The following patch fixes that in is_lambda_ignored_entity, other
possibility would be to do that before calling is_lambda_ignored_entity
in name-lookup.c.
2021-02-26 Jakub Jelinek <jakub@redhat.com>
PR c++/95451
* lambda.c (is_lambda_ignored_entity): Before checking for
LAMBDA_FUNCTION_P, use OVL_FIRST. Drop FUNCTION_DECL check.
* g++.dg/cpp1y/lambda-generic-95451.C: New test.
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug c++/95451] [8/9/10 regression] ICE for lambda capturing this and calling operator() since r8-2720-gf44a8dd56f5bfbd0
2020-05-31 14:33 [Bug c++/95451] New: [8/9/10 regression] ICE for lambda capturing this and calling operator() max.kanold@nu-cost.com
` (6 preceding siblings ...)
2021-02-26 9:44 ` cvs-commit at gcc dot gnu.org
@ 2021-02-26 9:48 ` jakub at gcc dot gnu.org
2021-03-12 0:20 ` mpolacek at gcc dot gnu.org
` (8 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-02-26 9:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95451
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[8/9/10/11 regression] ICE |[8/9/10 regression] ICE for
|for lambda capturing this |lambda capturing this and
|and calling operator() |calling operator() since
|since |r8-2720-gf44a8dd56f5bfbd0
|r8-2720-gf44a8dd56f5bfbd0 |
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed on the trunk so far.
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug c++/95451] [8/9/10 regression] ICE for lambda capturing this and calling operator() since r8-2720-gf44a8dd56f5bfbd0
2020-05-31 14:33 [Bug c++/95451] New: [8/9/10 regression] ICE for lambda capturing this and calling operator() max.kanold@nu-cost.com
` (7 preceding siblings ...)
2021-02-26 9:48 ` [Bug c++/95451] [8/9/10 " jakub at gcc dot gnu.org
@ 2021-03-12 0:20 ` mpolacek at gcc dot gnu.org
2021-03-12 0:23 ` mpolacek at gcc dot gnu.org
` (7 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-03-12 0:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95451
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |sfranzen85 at hotmail dot com
--- Comment #8 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
*** Bug 97214 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug c++/95451] [8/9/10 regression] ICE for lambda capturing this and calling operator() since r8-2720-gf44a8dd56f5bfbd0
2020-05-31 14:33 [Bug c++/95451] New: [8/9/10 regression] ICE for lambda capturing this and calling operator() max.kanold@nu-cost.com
` (8 preceding siblings ...)
2021-03-12 0:20 ` mpolacek at gcc dot gnu.org
@ 2021-03-12 0:23 ` mpolacek at gcc dot gnu.org
2021-03-18 10:50 ` jakub at gcc dot gnu.org
` (6 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-03-12 0:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95451
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |gcc at olupton dot com
--- Comment #9 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
*** Bug 90480 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug c++/95451] [8/9/10 regression] ICE for lambda capturing this and calling operator() since r8-2720-gf44a8dd56f5bfbd0
2020-05-31 14:33 [Bug c++/95451] New: [8/9/10 regression] ICE for lambda capturing this and calling operator() max.kanold@nu-cost.com
` (9 preceding siblings ...)
2021-03-12 0:23 ` mpolacek at gcc dot gnu.org
@ 2021-03-18 10:50 ` jakub at gcc dot gnu.org
2021-03-19 23:29 ` cvs-commit at gcc dot gnu.org
` (5 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-03-18 10:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95451
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |fiesh at zefix dot tv
--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
*** Bug 99640 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug c++/95451] [8/9/10 regression] ICE for lambda capturing this and calling operator() since r8-2720-gf44a8dd56f5bfbd0
2020-05-31 14:33 [Bug c++/95451] New: [8/9/10 regression] ICE for lambda capturing this and calling operator() max.kanold@nu-cost.com
` (10 preceding siblings ...)
2021-03-18 10:50 ` jakub at gcc dot gnu.org
@ 2021-03-19 23:29 ` cvs-commit at gcc dot gnu.org
2021-03-20 8:08 ` [Bug c++/95451] [8/9 " jakub at gcc dot gnu.org
` (4 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-19 23:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95451
--- Comment #11 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:8f9308936cf1df134d5aac1f890eb67266530ab5
commit r10-9477-g8f9308936cf1df134d5aac1f890eb67266530ab5
Author: Jakub Jelinek <jakub@redhat.com>
Date: Fri Feb 26 10:43:28 2021 +0100
c++: Fix operator() lookup in lambdas [PR95451]
During name lookup, name-lookup.c uses:
if (!(!iter->type && HIDDEN_TYPE_BINDING_P (iter))
&& (bool (want & LOOK_want::HIDDEN_LAMBDA)
|| !is_lambda_ignored_entity (iter->value))
&& qualify_lookup (iter->value, want))
binding = iter->value;
Unfortunately as the following testcase shows, this doesn't work in
generic lambdas, where we on the auto b = ... lambda ICE and on the
auto d = lambda reject it even when it should be valid. The problem
is that the binding doesn't have a FUNCTION_DECL with
LAMBDA_FUNCTION_P for the operator(), but an OVERLOAD with
TEMPLATE_DECL for such FUNCTION_DECL.
The following patch fixes that in is_lambda_ignored_entity, other
possibility would be to do that before calling is_lambda_ignored_entity
in name-lookup.c.
2021-02-26 Jakub Jelinek <jakub@redhat.com>
PR c++/95451
* lambda.c (is_lambda_ignored_entity): Before checking for
LAMBDA_FUNCTION_P, use OVL_FIRST. Drop FUNCTION_DECL check.
* g++.dg/cpp1y/lambda-generic-95451.C: New test.
(cherry picked from commit 27f9a87886d48448f83e0e559dcf028b1a4a4ec6)
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug c++/95451] [8/9 regression] ICE for lambda capturing this and calling operator() since r8-2720-gf44a8dd56f5bfbd0
2020-05-31 14:33 [Bug c++/95451] New: [8/9/10 regression] ICE for lambda capturing this and calling operator() max.kanold@nu-cost.com
` (11 preceding siblings ...)
2021-03-19 23:29 ` cvs-commit at gcc dot gnu.org
@ 2021-03-20 8:08 ` jakub at gcc dot gnu.org
2021-04-20 23:33 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-03-20 8:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95451
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[8/9/10 regression] ICE for |[8/9 regression] ICE for
|lambda capturing this and |lambda capturing this and
|calling operator() since |calling operator() since
|r8-2720-gf44a8dd56f5bfbd0 |r8-2720-gf44a8dd56f5bfbd0
--- Comment #12 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed for 10.3 too.
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug c++/95451] [8/9 regression] ICE for lambda capturing this and calling operator() since r8-2720-gf44a8dd56f5bfbd0
2020-05-31 14:33 [Bug c++/95451] New: [8/9/10 regression] ICE for lambda capturing this and calling operator() max.kanold@nu-cost.com
` (12 preceding siblings ...)
2021-03-20 8:08 ` [Bug c++/95451] [8/9 " jakub at gcc dot gnu.org
@ 2021-04-20 23:33 ` cvs-commit at gcc dot gnu.org
2021-04-22 16:51 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-20 23:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95451
--- Comment #13 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:1f7f4e1118ab7f1118a2977303b672ecec439a6b
commit r9-9427-g1f7f4e1118ab7f1118a2977303b672ecec439a6b
Author: Jakub Jelinek <jakub@redhat.com>
Date: Fri Feb 26 10:43:28 2021 +0100
c++: Fix operator() lookup in lambdas [PR95451]
During name lookup, name-lookup.c uses:
if (!(!iter->type && HIDDEN_TYPE_BINDING_P (iter))
&& (bool (want & LOOK_want::HIDDEN_LAMBDA)
|| !is_lambda_ignored_entity (iter->value))
&& qualify_lookup (iter->value, want))
binding = iter->value;
Unfortunately as the following testcase shows, this doesn't work in
generic lambdas, where we on the auto b = ... lambda ICE and on the
auto d = lambda reject it even when it should be valid. The problem
is that the binding doesn't have a FUNCTION_DECL with
LAMBDA_FUNCTION_P for the operator(), but an OVERLOAD with
TEMPLATE_DECL for such FUNCTION_DECL.
The following patch fixes that in is_lambda_ignored_entity, other
possibility would be to do that before calling is_lambda_ignored_entity
in name-lookup.c.
2021-02-26 Jakub Jelinek <jakub@redhat.com>
PR c++/95451
* lambda.c (is_lambda_ignored_entity): Before checking for
LAMBDA_FUNCTION_P, use OVL_FIRST. Drop FUNCTION_DECL check.
* g++.dg/cpp1y/lambda-generic-95451.C: New test.
(cherry picked from commit 8f9308936cf1df134d5aac1f890eb67266530ab5)
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug c++/95451] [8/9 regression] ICE for lambda capturing this and calling operator() since r8-2720-gf44a8dd56f5bfbd0
2020-05-31 14:33 [Bug c++/95451] New: [8/9/10 regression] ICE for lambda capturing this and calling operator() max.kanold@nu-cost.com
` (13 preceding siblings ...)
2021-04-20 23:33 ` cvs-commit at gcc dot gnu.org
@ 2021-04-22 16:51 ` cvs-commit at gcc dot gnu.org
2021-04-22 17:06 ` jakub at gcc dot gnu.org
2021-12-10 12:20 ` pinskia at gcc dot gnu.org
16 siblings, 0 replies; 18+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-22 16:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95451
--- Comment #14 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-8 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:a42f679e87e5982788981439d9d1ff2fdd7323e9
commit r8-10892-ga42f679e87e5982788981439d9d1ff2fdd7323e9
Author: Jakub Jelinek <jakub@redhat.com>
Date: Fri Feb 26 10:43:28 2021 +0100
c++: Fix operator() lookup in lambdas [PR95451]
During name lookup, name-lookup.c uses:
if (!(!iter->type && HIDDEN_TYPE_BINDING_P (iter))
&& (bool (want & LOOK_want::HIDDEN_LAMBDA)
|| !is_lambda_ignored_entity (iter->value))
&& qualify_lookup (iter->value, want))
binding = iter->value;
Unfortunately as the following testcase shows, this doesn't work in
generic lambdas, where we on the auto b = ... lambda ICE and on the
auto d = lambda reject it even when it should be valid. The problem
is that the binding doesn't have a FUNCTION_DECL with
LAMBDA_FUNCTION_P for the operator(), but an OVERLOAD with
TEMPLATE_DECL for such FUNCTION_DECL.
The following patch fixes that in is_lambda_ignored_entity, other
possibility would be to do that before calling is_lambda_ignored_entity
in name-lookup.c.
2021-02-26 Jakub Jelinek <jakub@redhat.com>
PR c++/95451
* lambda.c (is_lambda_ignored_entity): Before checking for
LAMBDA_FUNCTION_P, use OVL_FIRST. Drop FUNCTION_DECL check.
* g++.dg/cpp1y/lambda-generic-95451.C: New test.
(cherry picked from commit 8f9308936cf1df134d5aac1f890eb67266530ab5)
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug c++/95451] [8/9 regression] ICE for lambda capturing this and calling operator() since r8-2720-gf44a8dd56f5bfbd0
2020-05-31 14:33 [Bug c++/95451] New: [8/9/10 regression] ICE for lambda capturing this and calling operator() max.kanold@nu-cost.com
` (14 preceding siblings ...)
2021-04-22 16:51 ` cvs-commit at gcc dot gnu.org
@ 2021-04-22 17:06 ` jakub at gcc dot gnu.org
2021-12-10 12:20 ` pinskia at gcc dot gnu.org
16 siblings, 0 replies; 18+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-04-22 17:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95451
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #15 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug c++/95451] [8/9 regression] ICE for lambda capturing this and calling operator() since r8-2720-gf44a8dd56f5bfbd0
2020-05-31 14:33 [Bug c++/95451] New: [8/9/10 regression] ICE for lambda capturing this and calling operator() max.kanold@nu-cost.com
` (15 preceding siblings ...)
2021-04-22 17:06 ` jakub at gcc dot gnu.org
@ 2021-12-10 12:20 ` pinskia at gcc dot gnu.org
16 siblings, 0 replies; 18+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-10 12:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95451
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |nathan at gcc dot gnu.org
--- Comment #16 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 85171 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 18+ messages in thread