public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/115318] New: decltype(lambda) with some templates causes ICE
@ 2024-06-01 12:54 blubban at gmail dot com
2024-06-01 17:01 ` [Bug c++/115318] decltype(lambda) from an template function inside a templated lambda " pinskia at gcc dot gnu.org
2024-06-13 11:33 ` blubban at gmail dot com
0 siblings, 2 replies; 3+ messages in thread
From: blubban at gmail dot com @ 2024-06-01 12:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115318
Bug ID: 115318
Summary: decltype(lambda) with some templates causes ICE
Product: gcc
Version: 14.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: blubban at gmail dot com
Target Milestone: ---
template<typename T> struct S {};
template<int i = 4>
void foo()
{
using foo_t = decltype([](){});
[]<int k = 6>() { S<foo_t>{}; }();
}
void bar() { foo(); }
-std=c++20
<source>: In instantiation of 'foo<>()::<lambda()> [with int k = 6]':
<source>:7:36: required from 'void foo() [with int i = 4]'
7 | []<int k = 6>() { S<foo_t>{}; }();
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
<source>:10:17: required from here
10 | void bar() { foo(); }
| ~~~^~
<source>:6:28: internal compiler error: in tsubst, at cp/pt.cc:16401
6 | using foo_t = decltype([](){});
| ^~~~~~
0x202ef4c internal_error(char const*, ...)
???:0
0x778915 fancy_abort(char const*, int, char const*)
???:0
0x938dd0 tsubst(tree_node*, tree_node*, int, tree_node*)
???:0
0x943a11 tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*)
???:0
0x939200 tsubst(tree_node*, tree_node*, int, tree_node*)
???:0
0x93c437 tsubst_template_args(tree_node*, tree_node*, int, tree_node*)
???:0
0x931a0f instantiate_decl(tree_node*, bool, bool)
???:0
0x831fb7 maybe_instantiate_decl(tree_node*)
???:0
0x8332f7 mark_used(tree_node*, int)
???:0
0x7a20a3 build_op_call(tree_node*, vec<tree_node*, va_gc, vl_embed>**, int)
???:0
0x9602fe finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
???:0
0x931a0f instantiate_decl(tree_node*, bool, bool)
???:0
0x94d2e3 instantiate_pending_templates(int)
???:0
0x835608 c_parse_final_cleanups()
???:0
0xa0c508 c_common_parse_file()
???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1
If you make the first lambda a template ( decltype([]<int>(){}) ), you'll get a
internal compiler error: Segmentation fault instead. Probably the same root
cause.
Online reproducer: https://godbolt.org/z/EfxPxKWhd
I tried searching for duplicates, but every open issue I could find in bug
#107430 is a mess, I can't determine if it's the same.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/115318] decltype(lambda) from an template function inside a templated lambda causes ICE
2024-06-01 12:54 [Bug c++/115318] New: decltype(lambda) with some templates causes ICE blubban at gmail dot com
@ 2024-06-01 17:01 ` pinskia at gcc dot gnu.org
2024-06-13 11:33 ` blubban at gmail dot com
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-01 17:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115318
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Summary|decltype(lambda) with some |decltype(lambda) from an
|templates causes ICE |template function inside a
| |templated lambda causes ICE
Last reconfirmed| |2024-06-01
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/115318] decltype(lambda) from an template function inside a templated lambda causes ICE
2024-06-01 12:54 [Bug c++/115318] New: decltype(lambda) with some templates causes ICE blubban at gmail dot com
2024-06-01 17:01 ` [Bug c++/115318] decltype(lambda) from an template function inside a templated lambda " pinskia at gcc dot gnu.org
@ 2024-06-13 11:33 ` blubban at gmail dot com
1 sibling, 0 replies; 3+ messages in thread
From: blubban at gmail dot com @ 2024-06-13 11:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115318
--- Comment #2 from Alfred Agrell <blubban at gmail dot com> ---
struct a { int c; };
template<int=1>
struct ddd {
int f()
{
using a2 = decltype([]<int=2>(int a::*)->a{}(&a::c));
return []<int=4>(int a2::*){ return 2; }(&a::c);
}
};
int xs() { return ddd().f(); }
-std=c++20 again
-> <source>:8:16: sorry, unimplemented: mangling offset_ref
https://godbolt.org/z/4M3ToqqPW
Adding a <int=2> to the first lambda changes the error to the same ICE as this
issue (https://godbolt.org/z/Pq9T16GvP), so I'm about 98% sure it's the same
root cause.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-06-13 11:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-01 12:54 [Bug c++/115318] New: decltype(lambda) with some templates causes ICE blubban at gmail dot com
2024-06-01 17:01 ` [Bug c++/115318] decltype(lambda) from an template function inside a templated lambda " pinskia at gcc dot gnu.org
2024-06-13 11:33 ` blubban at gmail dot com
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).