https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95711
Bug ID: 95711 Summary: namespace alias fails inside coroutine Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: alejandromagic at hotmail dot com Target Milestone: --- Created attachment 48743 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48743&action=edit Preprocessed file The following codes triggers a "Compiler internal Error": namespace A { } generator<int> parse() { namespace B = A; co_yield 1; } Where generator<T> is just any generator implementation I've tried (I don't think it have nothing to do with its actual implementation anyway, so I'm providing the simplest working generator in the attached files). It essentially happens when any namespace alias is defined inside a lambda. As an attachment I provide the preprocessed file, although I guess the source should be enough (I only #include coroutine for obvious reasons). The command used to compile is: gcc -v -save-temps --std=c++20 -fcoroutines main.cpp The system is: Linux parrot 4.14.0-parrot13-amd64 #1 SMP Parrot 4.14.13-1parrot13 (2018-01-21) x86_64 GNU/Linux The output of the compiler (in case it is needed): Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-pc-linux-gnu/11.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc/configure --disable-multilib --enable-languages=c,c++,go Thread model: posix Supported LTO compression algorithms: zlib gcc version 11.0.0 20200507 (experimental) (GCC) COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++2a' '-fcoroutines' '-mtune=generic' '-march=x86-64' /usr/local/libexec/gcc/x86_64-pc-linux-gnu/11.0.0/cc1plus -E -quiet -v -imultiarch x86_64-linux-gnu -D_GNU_SOURCE main.cpp -mtune=generic -march=x86-64 -std=c++2a -fcoroutines -fpch-preprocess -o main.ii ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu" ignoring nonexistent directory "/usr/local/lib/gcc/x86_64-pc-linux-gnu/11.0.0/../../../../x86_64-pc-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /usr/local/lib/gcc/x86_64-pc-linux-gnu/11.0.0/../../../../include/c++/11.0.0 /usr/local/lib/gcc/x86_64-pc-linux-gnu/11.0.0/../../../../include/c++/11.0.0/x86_64-pc-linux-gnu /usr/local/lib/gcc/x86_64-pc-linux-gnu/11.0.0/../../../../include/c++/11.0.0/backward /usr/local/lib/gcc/x86_64-pc-linux-gnu/11.0.0/include /usr/local/include /usr/local/lib/gcc/x86_64-pc-linux-gnu/11.0.0/include-fixed /usr/include/x86_64-linux-gnu /usr/include End of search list. COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++2a' '-fcoroutines' '-mtune=generic' '-march=x86-64' /usr/local/libexec/gcc/x86_64-pc-linux-gnu/11.0.0/cc1plus -fpreprocessed main.ii -quiet -dumpbase main.cpp -mtune=generic -march=x86-64 -auxbase main -std=c++2a -version -fcoroutines -o main.s GNU C++17 (GCC) version 11.0.0 20200507 (experimental) (x86_64-pc-linux-gnu) compiled by GNU C version 11.0.0 20200507 (experimental), GMP version 6.2.0, MPFR version 4.0.2, MPC version 1.1.0, isl version none GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 GNU C++17 (GCC) version 11.0.0 20200507 (experimental) (x86_64-pc-linux-gnu) compiled by GNU C version 11.0.0 20200507 (experimental), GMP version 6.2.0, MPFR version 4.0.2, MPC version 1.1.0, isl version none GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 Compiler executable checksum: 879e7d5007757f82203f25a489026164 main.cpp: In function ‘generator<int> parse()’: main.cpp:60:1: internal compiler error: tree check: expected var_decl or parm_decl or result_decl, have namespace_decl in register_local_var_uses, at cp/coroutines.cc:3440 60 | } | ^ 0x7df6ea tree_check_failed(tree_node const*, char const*, int, char const*, ...) ../../gcc/gcc/tree.c:9731 0x61a5d5 tree_check3(tree_node*, char const*, int, char const*, tree_code, tree_code, tree_code) ../../gcc/gcc/tree.h:3334 0x61a5d5 register_local_var_uses ../../gcc/gcc/cp/coroutines.cc:3440 0x12ab9fa walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*), void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*, tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*)) ../../gcc/gcc/tree.c:12001 0x8e44e6 morph_fn_to_coro(tree_node*, tree_node**, tree_node**) ../../gcc/gcc/cp/coroutines.cc:3815 0x92ebf1 finish_function(bool) ../../gcc/gcc/cp/decl.c:16921 0x9d8427 cp_parser_function_definition_after_declarator ../../gcc/gcc/cp/parser.c:29013 0x9d9409 cp_parser_function_definition_from_specifiers_and_declarator ../../gcc/gcc/cp/parser.c:28926 0x9d9409 cp_parser_init_declarator ../../gcc/gcc/cp/parser.c:20675 0x9ba1d2 cp_parser_simple_declaration ../../gcc/gcc/cp/parser.c:13739 0x9e33d2 cp_parser_declaration ../../gcc/gcc/cp/parser.c:13438 0x9e3b5a cp_parser_translation_unit ../../gcc/gcc/cp/parser.c:4734 0x9e3b5a c_parse_file() ../../gcc/gcc/cp/parser.c:43989 0xaf965b c_common_parse_file() ../../gcc/gcc/c-family/c-opts.c:1190 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions.