https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83024
Bug ID: 83024 Summary: ICE in build_address, at cp/typeck.c:5623 Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: guille at berkeley dot edu Target Milestone: --- The following short code ICEs on $ c++ -v Using built-in specs. COLLECT_GCC=c++ COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-pc-linux-gnu/8.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../configure --enable-languages=c,c++ --disable-multilib Thread model: posix gcc version 8.0.0 20171112 (experimental) (GCC) Code that triggers ICE follows: --------------- #include <optional> template <class T> struct __optional : std::optional<T> { __optional() = default; __optional(T&& t) : std::optional<T> (std::move(t)) {} operator bool () const { return (bool)(const std::optional<T>&)*this; } // <- omit this line and it compiles fine }; struct A : __optional<int> { static __optional<A> parse(auto& q) { return A{}; } }; int main() { int q; auto p = A::parse(q); return 0; } ICE message follows: --------------------- $ c++ -fconcepts -std=c++1z tt.c -o tt tt.c: In static member function ‘static __optional<A> A::parse(auto:1&)’: tt.c:14:12: internal compiler error: in build_address, at cp/typeck.c:5623 return A{}; ^ 0x931657 build_address(tree_node*) ../../gcc/cp/typeck.c:5623 0x6fe147 add_function_candidate ../../gcc/cp/call.c:2166 0x6ffa87 add_candidates ../../gcc/cp/call.c:5522 0x6fab4e add_candidates ../../gcc/cp/call.c:5433 0x6fab4e build_user_type_conversion_1 ../../gcc/cp/call.c:3849 0x6fc4f9 implicit_conversion ../../gcc/cp/call.c:1897 0x6f80a0 perform_implicit_conversion_flags(tree_node*, tree_node*, int, int) ../../gcc/cp/call.c:10559 0x94a905 check_return_expr(tree_node*, bool*) ../../gcc/cp/typeck.c:9218 0x8ee65e finish_return_stmt(tree_node*) ../../gcc/cp/semantics.c:893 0x843bd5 cp_parser_jump_statement ../../gcc/cp/parser.c:12483 0x843bd5 cp_parser_statement ../../gcc/cp/parser.c:10897 0x844b30 cp_parser_statement_seq_opt ../../gcc/cp/parser.c:11348 0x844c07 cp_parser_compound_statement ../../gcc/cp/parser.c:11302 0x85e2b1 cp_parser_function_body ../../gcc/cp/parser.c:21837 0x85e2b1 cp_parser_ctor_initializer_opt_and_function_body ../../gcc/cp/parser.c:21874 0x860ea6 cp_parser_function_definition_after_declarator ../../gcc/cp/parser.c:26765 0x8620fc cp_parser_late_parsing_for_member ../../gcc/cp/parser.c:27645 0x851c59 cp_parser_class_specifier_1 ../../gcc/cp/parser.c:22728 0x853221 cp_parser_class_specifier ../../gcc/cp/parser.c:22754 0x853221 cp_parser_type_specifier ../../gcc/cp/parser.c:16818 Please submit a full bug report,