+2020-05-14 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/78446
+ * call.c (build_op_call): Pass complain to lookup_fnfields.
+ (build_special_member_call): Likewise.
+ * class.c (type_requires_array_cookie): Pass tf_warning_or_error
+ to lookup_fnfields.
+ * cp-tree.h (lookup_fnfields): Add tsubst_flags_t parameter.
+ * except.c (build_throw): Pass tf_warning_or_error to
+ lookup_fnfields.
+ * init.c (build_new_1): Pass complain to lookup_fnfields.
+ * method.c (locate_fn_flags): Likewise.
+ * name-lookup.c (lookup_name_real_1): Pass tf_warning_or_error
+ to lookup_fnfields.
+ * pt.c (tsubst_baselink): Pass complain to lookup_fnfields.
+ * search.c (lookup_fnfields): New 'complain' parameter. Pass it
+ to lookup_member.
+
2020-05-14 Nathan Sidwell <nathan@acm.org>
* parser.c (cp_parser_diagnose_invalid_typename): Mention
if (TYPE_BINFO (type))
{
- fns = lookup_fnfields (TYPE_BINFO (type), call_op_identifier, 1);
+ fns = lookup_fnfields (TYPE_BINFO (type), call_op_identifier, 1, complain);
if (fns == error_mark_node)
return error_mark_node;
}
tree arg2_type = nargs > 1 ? TREE_TYPE ((*arglist)[1]) : NULL_TREE;
if (CLASS_TYPE_P (arg1_type))
{
- tree fns = lookup_fnfields (arg1_type, fnname, 1);
+ tree fns = lookup_fnfields (arg1_type, fnname, 1, complain);
if (fns == error_mark_node)
return error_mark_node;
if (fns)
Therefore, we ask lookup_fnfields to complain about ambiguity. */
{
- fns = lookup_fnfields (TYPE_BINFO (type), fnname, 1);
+ fns = lookup_fnfields (TYPE_BINFO (type), fnname, 1, complain);
if (fns == error_mark_node)
return error_mark_node;
}
}
}
- fns = lookup_fnfields (binfo, name, 1);
+ fns = lookup_fnfields (binfo, name, 1, complain);
/* When making a call to a constructor or destructor for a subobject
that uses virtual base classes, pass down a pointer to a VTT for
a cookie. */
fns = lookup_fnfields (TYPE_BINFO (type),
ovl_op_identifier (false, VEC_DELETE_EXPR),
- /*protect=*/0);
+ /*protect=*/0, tf_warning_or_error);
/* If there are no `operator []' members, or the lookup is
ambiguous, then we don't need a cookie. */
if (!fns || fns == error_mark_node)
extern int accessible_p (tree, tree, bool);
extern int accessible_in_template_p (tree, tree);
extern tree lookup_field (tree, tree, int, bool);
-extern tree lookup_fnfields (tree, tree, int);
+extern tree lookup_fnfields (tree, tree, int, tsubst_flags_t);
extern tree lookup_member (tree, tree, int, bool,
tsubst_flags_t,
access_failure_info *afi = NULL);
if (type_build_dtor_call (TREE_TYPE (object)))
{
tree dtor_fn = lookup_fnfields (TYPE_BINFO (TREE_TYPE (object)),
- complete_dtor_identifier, 0);
+ complete_dtor_identifier, 0,
+ tf_warning_or_error);
dtor_fn = BASELINK_FUNCTIONS (dtor_fn);
mark_used (dtor_fn);
if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TREE_TYPE (object)))
/* Create the argument list. */
vec_safe_insert (*placement, 0, size);
/* Do name-lookup to find the appropriate operator. */
- fns = lookup_fnfields (elt_type, fnname, /*protect=*/2);
+ fns = lookup_fnfields (elt_type, fnname, /*protect=*/2, complain);
if (fns == NULL_TREE)
{
if (complain & tf_error)
}
}
- fns = lookup_fnfields (binfo, name, 0);
+ fns = lookup_fnfields (binfo, name, 0, complain);
rval = build_new_method_call (ob, fns, &args, binfo, flags, &fn, complain);
if (fn && rval == error_mark_node)
/* Lookup the conversion operator in the class. */
class_type = level->this_entity;
- operators = lookup_fnfields (class_type, name, /*protect=*/0);
+ operators = lookup_fnfields (class_type, name, /*protect=*/0,
+ tf_warning_or_error);
if (operators)
return operators;
}
/* Treat as-if non-dependent below. */
dependent_p = false;
- baselink = lookup_fnfields (qualifying_scope, name, /*protect=*/1);
+ baselink = lookup_fnfields (qualifying_scope, name, /*protect=*/1,
+ complain);
if (!baselink)
{
if ((complain & tf_error)
return NULL_TREE. */
tree
-lookup_fnfields (tree xbasetype, tree name, int protect)
+lookup_fnfields (tree xbasetype, tree name, int protect,
+ tsubst_flags_t complain)
{
tree rval = lookup_member (xbasetype, name, protect, /*want_type=*/false,
- tf_warning_or_error);
+ complain);
/* Ignore non-functions, but propagate the ambiguity list. */
if (!error_operand_p (rval)
+2020-05-14 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/78446
+ * g++.dg/template/sfinae31.C: New test.
+
2020-05-14 Uroš Bizjak <ubizjak@gmail.com>
PR target/95046
--- /dev/null
+// PR c++/78446
+// { dg-do compile { target c++11 } }
+
+struct A { void operator()(); };
+struct B { void operator()(); };
+struct C : A, B {};
+
+template<class T>
+decltype(T()()) foo(int);
+
+template<class> int foo(...);
+
+using type = decltype(foo<C>(0));
+using type = int;