&& !type_has_nontrivial_copy_init (TREE_TYPE (expr)))
return get_target_expr_sfinae (expr, complain);
+ /* In decltype, we might have decided not to wrap this call in a TARGET_EXPR.
+ But it turns out to be a subexpression, so perform temporary
+ materialization now. */
+ if (TREE_CODE (expr) == CALL_EXPR
+ && CLASS_TYPE_P (type)
+ && same_type_ignoring_top_level_qualifiers_p (type, TREE_TYPE (expr)))
+ expr = build_cplus_new (type, expr, complain);
+
savew = warningcount + werrorcount, savee = errorcount;
args = make_tree_vector_single (expr);
expr = build_special_member_call (NULL_TREE, complete_ctor_identifier,
--- /dev/null
+// PR c++/95675
+// { dg-do compile { target c++11 } }
+
+struct b {};
+b operator|(b, b) { return {}; }
+b e, f, g;
+using h = decltype(e | f | g);
--- /dev/null
+// PR c++/95675
+// { dg-do compile { target c++11 } }
+
+struct a {};
+template <typename> struct b;
+template <typename bq, typename br> struct b<bq(br)> {
+ decltype(bq()(br())) c;
+};
+struct e {
+ operator a();
+};
+b<e (*(e))(a)> d;