https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122351
Bug ID: 122351
Summary: in pp_string, at pretty-print.cc:2655
Product: gcc
Version: 15.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: qingren2hxb at gmail dot com
Target Milestone: ---
Created attachment 62588
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=62588&action=edit
bug report by using -freport-bug
========================================
$g++ -v
Using built-in specs.
COLLECT_GCC=/workspace/installation/bin/g++
COLLECT_LTO_WRAPPER=/workspace/installation/libexec/gcc/x86_64-pc-linux-gnu/15.1.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /workspace/gcc/configure --prefix=/workspace/installation
--enable-coverage --enable-checking --disable-multilib --disable-shared
--disable-bootstrap --enable-languages=c,c++
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 15.1.0 (GCC)
========================================
// test.C
#include <coroutine>
#include <utility>
template <int ...I>
struct dummy_coro {
struct promise_type {};
};
template <int ...I>
dummy_coro<I...> foo() {
I i;
auto bar = [i](int) { return std::suspend_never{}; };
co_await bar(i);
((co_await [](int){ return std::suspend_never{}; }(I)), ...);
}
int main() {
foo<0,1,2>();
}
========================================
$ g++ -std=c++20 test.C
test.C: In function 'dummy_coro<I ...> foo()':
test.C:11:4: error: expected ';' before 'i' [-Wtemplate-body]
11 | I i;
| ^~
| ;
test.C:11:6: error: parameter packs not expanded with '...': [-Wtemplate-body]
11 | I i;
| ^
test.C:11:6: note: 'I'
test.C:12:15: error: 'i' was not declared in this scope [-Wtemplate-body]
12 | auto bar = [i](int) { return std::suspend_never{}; };
| ^
in pp_string, at pretty-print.cc:2655
0x5d4e2e6 internal_error(char const*, ...)
/workspace/gcc/gcc/diagnostic-global-context.cc:517
0x5cf3c1f fancy_abort(char const*, int, char const*)
/workspace/gcc/gcc/diagnostic.cc:1749
0x5da3589 pp_string(pretty_printer*, char const*)
/workspace/gcc/gcc/pretty-print.cc:2655
0x5d9fef9 format_phase_2
/workspace/gcc/gcc/pretty-print.cc:2035
0x5d9d9a0 pretty_printer::format(text_info&)
/workspace/gcc/gcc/pretty-print.cc:1711
0x18d7bac pp_format(pretty_printer*, text_info*)
/workspace/gcc/gcc/pretty-print.h:594
0x5da20e8 pp_format_verbatim(pretty_printer*, text_info*)
/workspace/gcc/gcc/pretty-print.cc:2339
0x5da3224 pp_verbatim(pretty_printer*, char const*, ...)
/workspace/gcc/gcc/pretty-print.cc:2618
0x11c4fa0 print_instantiation_full_context
/workspace/gcc/gcc/cp/error.cc:3868
0x11c5845 maybe_print_instantiation_context
/workspace/gcc/gcc/cp/error.cc:4086
0x11c25d7 cp_diagnostic_text_starter
/workspace/gcc/gcc/cp/error.cc:3699
0x5d46508 diagnostic_text_output_format::on_report_diagnostic(diagnostic_info
const&, diagnostic_t)
/workspace/gcc/gcc/diagnostic-format-text.cc:209
0x5cf2d7b diagnostic_context::report_diagnostic(diagnostic_info*)
/workspace/gcc/gcc/diagnostic.cc:1510
0x5cf36f9 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
/workspace/gcc/gcc/diagnostic.cc:1641
0x5d4d86c error_at(unsigned long, char const*, ...)
/workspace/gcc/gcc/diagnostic-global-context.cc:425
0x101d536 lookup_promise_method
/workspace/gcc/gcc/cp/coroutines.cc:919
0x101d5b5 coro_build_promise_expression
/workspace/gcc/gcc/cp/coroutines.cc:936
0x1027c93 build_init_or_final_await
/workspace/gcc/gcc/cp/coroutines.cc:2803
0x1032a9c cp_coroutine_transform::wrap_original_function_body()
/workspace/gcc/gcc/cp/coroutines.cc:4359
0x103843a cp_coroutine_transform::apply_transforms()
/workspace/gcc/gcc/cp/coroutines.cc:5431
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.