bool
maybe_instantiate_noexcept (tree fn, tsubst_flags_t complain)
{
- tree fntype, spec, noex;
+ if (fn == error_mark_node)
+ return false;
/* Don't instantiate a noexcept-specification from template context. */
if (processing_template_decl
return !DECL_MAYBE_DELETED (fn);
}
- fntype = TREE_TYPE (fn);
- spec = TYPE_RAISES_EXCEPTIONS (fntype);
+ tree fntype = TREE_TYPE (fn);
+ tree spec = TYPE_RAISES_EXCEPTIONS (fntype);
if (!spec || !TREE_PURPOSE (spec))
return true;
- noex = TREE_PURPOSE (spec);
+ tree noex = TREE_PURPOSE (spec);
if (TREE_CODE (noex) != DEFERRED_NOEXCEPT
&& TREE_CODE (noex) != DEFERRED_PARSE)
return true;
--- /dev/null
+// PR c++/98659
+// { dg-do compile }
+
+template <bool> struct enable_if;
+struct function {
+ template <typename _F> void operator=(_F);
+};
+struct map {
+ function operator[](int);
+};
+enum { E };
+template <typename> void foo ();
+template <typename T>
+typename enable_if<T::value>::type foo ();
+
+void
+bar ()
+{
+ map m;
+ m[E] = foo<int>;
+}