public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/101043] New: ICE in check_noexcept_r for lambda conditional noexcept via requires expression
@ 2021-06-13 1:46 jbassett271 at gmail dot com
2021-06-14 8:57 ` [Bug c++/101043] " marxin at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: jbassett271 at gmail dot com @ 2021-06-13 1:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101043
Bug ID: 101043
Summary: ICE in check_noexcept_r for lambda conditional
noexcept via requires expression
Product: gcc
Version: 10.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jbassett271 at gmail dot com
Target Milestone: ---
GCC has an internal compiler error for requires expressions inside the noexcept
clause of a lambda inside a templated function:
https://godbolt.org/z/oWhq9sf8M
template <typename T>
struct set {
bool contains(T const&) const { return true; }
};
template <typename T>
void intersect(set<T> const& lhs, set<T> const& rhs) {
auto f = [&]<typename T1>(T1&& _1) noexcept(requires {
{ rhs.contains(_1) } noexcept;
}) {
return rhs.contains(_1);
};
}
int main() {
set<int> lhs;
set<int> rhs;
intersect(lhs, rhs);
}
Error message:
<source>: In instantiation of 'void intersect(const set<T>&, const set<T>&)
[with T = int]':
<source>:18:21: required from here
<source>:9:7: internal compiler error: in check_noexcept_r, at cp/except.c:1123
9 | { rhs.contains(_1) } noexcept;
| ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
The commandline arguments, according to the Compiler Explorer link (cleaned a
little):
-g -o output.s -masm=intel -S -fdiagnostics-color=always -std=c++20 example.cpp
Clang compiles this fine.
I was able to replicate this bug in GCC versions 10.1, 10.2, 10.3, and 11.1.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/101043] ICE in check_noexcept_r for lambda conditional noexcept via requires expression
2021-06-13 1:46 [Bug c++/101043] New: ICE in check_noexcept_r for lambda conditional noexcept via requires expression jbassett271 at gmail dot com
@ 2021-06-14 8:57 ` marxin at gcc dot gnu.org
2021-10-01 10:22 ` pinskia at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-06-14 8:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101043
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Last reconfirmed| |2021-06-14
CC| |jason at gcc dot gnu.org,
| |marxin at gcc dot gnu.org
--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r10-3735-gcb57504a55015891. It was rejected before the revision.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/101043] ICE in check_noexcept_r for lambda conditional noexcept via requires expression
2021-06-13 1:46 [Bug c++/101043] New: ICE in check_noexcept_r for lambda conditional noexcept via requires expression jbassett271 at gmail dot com
2021-06-14 8:57 ` [Bug c++/101043] " marxin at gcc dot gnu.org
@ 2021-10-01 10:22 ` pinskia at gcc dot gnu.org
2021-10-01 10:25 ` pinskia at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-10-01 10:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101043
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2021-06-14 00:00:00 |2021-10-1
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The ICE moved in GCC 11+:
<source>: In instantiation of 'void intersect(const set<T>&, const set<T>&)
[with T = int]':
<source>:19:12: required from here
<source>:9:12: internal compiler error: in strip_typedefs_expr, at
cp/tree.c:1864
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/101043] ICE in check_noexcept_r for lambda conditional noexcept via requires expression
2021-06-13 1:46 [Bug c++/101043] New: ICE in check_noexcept_r for lambda conditional noexcept via requires expression jbassett271 at gmail dot com
2021-06-14 8:57 ` [Bug c++/101043] " marxin at gcc dot gnu.org
2021-10-01 10:22 ` pinskia at gcc dot gnu.org
@ 2021-10-01 10:25 ` pinskia at gcc dot gnu.org
2023-11-15 17:18 ` cvs-commit at gcc dot gnu.org
2023-11-15 17:20 ` ppalka at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-10-01 10:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101043
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=98333
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #2)
> The ICE moved in GCC 11+:
> <source>: In instantiation of 'void intersect(const set<T>&, const set<T>&)
> [with T = int]':
> <source>:19:12: required from here
> <source>:9:12: internal compiler error: in strip_typedefs_expr, at
> cp/tree.c:1864
Maybe the patch for PR 98333 changed where the ICE is ...
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/101043] ICE in check_noexcept_r for lambda conditional noexcept via requires expression
2021-06-13 1:46 [Bug c++/101043] New: ICE in check_noexcept_r for lambda conditional noexcept via requires expression jbassett271 at gmail dot com
` (2 preceding siblings ...)
2021-10-01 10:25 ` pinskia at gcc dot gnu.org
@ 2023-11-15 17:18 ` cvs-commit at gcc dot gnu.org
2023-11-15 17:20 ` ppalka at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-11-15 17:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101043
--- 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:40a7707a7ea3568cee2cd80cd7e83b7eda678410
commit r14-5504-g40a7707a7ea3568cee2cd80cd7e83b7eda678410
Author: Patrick Palka <ppalka@redhat.com>
Date: Wed Nov 15 12:17:55 2023 -0500
c++: partially inst requires-expr in noexcept-spec [PR101043]
Here we're ICEing from strip_typedefs for the partially instantiated
requires-expression when walking its REQUIRES_EXPR_EXTRA_ARGS which
in this case is a TREE_LIST with non-empty TREE_PURPOSE (to hold the
captured local specialization 't' as per build_extra_args) which
strip_typedefs doesn't expect.
We can probably skip walking REQUIRES_EXPR_EXTRA_ARGS at all since it
shouldn't contain any typedefs in the first place, but it seems safer
and more generally useful to just teach strip_typedefs to handle non-empty
TREE_PURPOSE the obvious way. (The code asserts TREE_PURPOSE was empty
even since since its inception i.e. r189298.)
PR c++/101043
gcc/cp/ChangeLog:
* tree.cc (strip_typedefs_expr) <case TREE_LIST>: Handle
non-empty TREE_PURPOSE.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/concepts-requires37.C: New test.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/101043] ICE in check_noexcept_r for lambda conditional noexcept via requires expression
2021-06-13 1:46 [Bug c++/101043] New: ICE in check_noexcept_r for lambda conditional noexcept via requires expression jbassett271 at gmail dot com
` (3 preceding siblings ...)
2023-11-15 17:18 ` cvs-commit at gcc dot gnu.org
@ 2023-11-15 17:20 ` ppalka at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-11-15 17:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101043
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
Resolution|--- |FIXED
Status|NEW |RESOLVED
CC| |ppalka at gcc dot gnu.org
Target Milestone|--- |14.0
--- Comment #5 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 14.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-11-15 17:20 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-13 1:46 [Bug c++/101043] New: ICE in check_noexcept_r for lambda conditional noexcept via requires expression jbassett271 at gmail dot com
2021-06-14 8:57 ` [Bug c++/101043] " marxin at gcc dot gnu.org
2021-10-01 10:22 ` pinskia at gcc dot gnu.org
2021-10-01 10:25 ` pinskia at gcc dot gnu.org
2023-11-15 17:18 ` cvs-commit at gcc dot gnu.org
2023-11-15 17:20 ` 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).