https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101449
Bug ID: 101449 Summary: [modules] internal compiler error: in cxx_eval_call_expression Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ensadc at mailnesia dot com Target Milestone: --- $ cat str.cpp export module str; export struct str { constexpr str() { ptr = new char[42]; } constexpr ~str() { delete[] ptr; } const char* ptr = nullptr; }; export constexpr str get_str() { return str{}; } $ cat main.cpp import str; int main() { str a = get_str(); } $ g++ -std=c++2b -fmodules-ts str.cpp main.cpp main.cpp: In function ‘int main()’: main.cpp:4:21: in ‘constexpr’ expansion of ‘get_str@str()()’ main.cpp:4:21: internal compiler error: in cxx_eval_call_expression, at cp/constexpr.c:2742 4 | str a = get_str(); | ^ 0x652ee9 cxx_eval_call_expression ../../gcc/gcc/cp/constexpr.c:2742 0x9e54f1 cxx_eval_constant_expression ../../gcc/gcc/cp/constexpr.c:6250 0x9e8829 cxx_eval_outermost_constant_expr ../../gcc/gcc/cp/constexpr.c:7282 0x9ed921 maybe_constant_value(tree_node*, tree_node*, bool) ../../gcc/gcc/cp/constexpr.c:7556 0xa20665 cp_fully_fold(tree_node*) ../../gcc/gcc/cp/cp-gimplify.c:2146 0xa207f4 cp_fully_fold(tree_node*) ../../gcc/gcc/cp/cp-gimplify.c:2140 0xa207f4 cp_fully_fold_init(tree_node*) ../../gcc/gcc/cp/cp-gimplify.c:2167 0xc16e03 store_init_value(tree_node*, tree_node*, vec<tree_node*, va_gc, vl_embed>**, int) ../../gcc/gcc/cp/typeck2.c:816 0xa3a300 check_initializer ../../gcc/gcc/cp/decl.c:7169 0xa5dfd0 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int) ../../gcc/gcc/cp/decl.c:8103 0xb4a89f cp_parser_init_declarator ../../gcc/gcc/cp/parser.c:22258 0xb2608d cp_parser_simple_declaration ../../gcc/gcc/cp/parser.c:14801 0xb27d69 cp_parser_declaration_statement ../../gcc/gcc/cp/parser.c:13936 0xb28743 cp_parser_statement ../../gcc/gcc/cp/parser.c:12066 0xb2904e cp_parser_statement_seq_opt ../../gcc/gcc/cp/parser.c:12433 0xb29128 cp_parser_compound_statement ../../gcc/gcc/cp/parser.c:12382 0xb48ff0 cp_parser_function_body ../../gcc/gcc/cp/parser.c:24448 0xb48ff0 cp_parser_ctor_initializer_opt_and_function_body ../../gcc/gcc/cp/parser.c:24499 0xb49aea cp_parser_function_definition_after_declarator ../../gcc/gcc/cp/parser.c:30572 0xb4ac96 cp_parser_function_definition_from_specifiers_and_declarator ../../gcc/gcc/cp/parser.c:30488 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.