Skip to content
Snippets Groups Projects
Commit c755c7a3 authored by Marek Polacek's avatar Marek Polacek
Browse files

c++: noexcept and pointer to member function type [PR113108]

We ICE in nothrow_spec_p because it got a DEFERRED_NOEXCEPT.
This DEFERRED_NOEXCEPT was created in implicitly_declare_fn
when declaring

  Foo& operator=(Foo&&) = default;

in the test.  The problem is that in resolve_overloaded_unification
we call maybe_instantiate_noexcept before try_one_overload only in
the TEMPLATE_ID_EXPR case.

	PR c++/113108

gcc/cp/ChangeLog:

	* pt.cc (resolve_overloaded_unification): Call
	maybe_instantiate_noexcept.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp1z/noexcept-type28.C: New test.
parent 858918ef
No related branches found
No related tags found
No related merge requests found
...@@ -23787,6 +23787,8 @@ resolve_overloaded_unification (tree tparms, ...@@ -23787,6 +23787,8 @@ resolve_overloaded_unification (tree tparms,
for (lkp_iterator iter (arg); iter; ++iter) for (lkp_iterator iter (arg); iter; ++iter)
{ {
tree fn = *iter; tree fn = *iter;
if (flag_noexcept_type)
maybe_instantiate_noexcept (fn, tf_none);
if (try_one_overload (tparms, targs, tempargs, parm, TREE_TYPE (fn), if (try_one_overload (tparms, targs, tempargs, parm, TREE_TYPE (fn),
strict, sub_strict, addr_p, explain_p) strict, sub_strict, addr_p, explain_p)
&& (!goodfn || !decls_match (goodfn, fn))) && (!goodfn || !decls_match (goodfn, fn)))
......
// PR c++/113108
// { dg-do compile { target c++17 } }
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=);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment