===================================================================
@@ -7112,8 +7112,9 @@ build_over_call (struct z_candidate *cand, int fla
mark_versions_used (fn);
}
- if (!already_used)
- mark_used (fn);
+ if (!already_used
+ && !mark_used (fn))
+ return error_mark_node;
if (DECL_VINDEX (fn) && (flags & LOOKUP_NONVIRTUAL) == 0
/* Don't mess with virtual lookup in fold_non_dependent_expr; virtual
===================================================================
@@ -0,0 +1,6 @@
+// PR c++/58581
+// { dg-do compile { target c++11 } }
+
+template<typename T> int foo(T) noexcept(T()) = delete;
+
+int i = foo(0); // { dg-error "deleted" }