https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113108

            Bug ID: 113108
           Summary: Internal compiler error when choosing overload for
                    operator=
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kyrylo.bohdanenko at gmail dot com
  Target Milestone: ---

The following code causes GCC internal error:

template <typename T>
struct Foo {
    Foo& operator=(Foo&&) = default;
    T data;
};

template <typename T>
void consume(Foo<T>& (Foo<T>::*)(Foo<T>&&) ) {}

template <typename T>
void consume(Foo<T>& (Foo<T>::*)(Foo<T>&&) noexcept) {}

int main() {
    consume(&Foo<int>::operator=);
}

Output:
<source>: In substitution of 'template<class T> void consume(Foo<T>&
(Foo<T>::*)(Foo<T>&&) noexcept) [with T = <missing>]':
<source>:26:12:   required from here
   26 |     consume(&Foo<int>::operator=);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
<source>:26:12: internal compiler error: in nothrow_spec_p, at
cp/except.cc:1201
0x262b4bc internal_error(char const*, ...)
        ???:0
0xa4d583 fancy_abort(char const*, int, char const*)
        ???:0
0xca6a7f fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, conversion**, bool,
bool)
        ???:0
0xa7cfd9 build_new_function_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
        ???:0
0xcc6c76 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
        ???:0
0xc4b8ba c_parse_file()
        ???:0
0xd9cda9 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.

Reply via email to