parameter pack is a non-deduced context. */
continue;
+ /* [temp.deduct.conv] only applies to the deduction of the return
+ type, which is always the first argument here. Other arguments
+ (notably, explicit object parameters) should undergo normal
+ call-like unification. */
+ unification_kind_t kind = strict;
+ if (strict == DEDUCE_CONV && ia > 0)
+ kind = DEDUCE_CALL;
+
arg = args[ia];
++ia;
- if (unify_one_argument (tparms, full_targs, parm, arg, subr, strict,
+ if (unify_one_argument (tparms, full_targs, parm, arg, subr, kind,
explain_p))
return 1;
}
&& parms != void_list_node
&& TREE_CODE (TREE_VALUE (parms)) == TYPE_PACK_EXPANSION)
{
+ gcc_assert (strict != DEDUCE_CONV);
+
/* Unify the remaining arguments with the pack expansion type. */
tree argvec;
tree parmvec = make_tree_vec (1);
--- /dev/null
+// PR c++/113629
+// { dg-do compile { target c++23 } }
+
+template <typename T> constexpr bool is_lvalue = false;
+template <typename T> constexpr bool is_lvalue<T&> = true;
+
+struct A {
+ constexpr operator bool(this auto&& self) {
+ return is_lvalue<decltype(self)>;
+ }
+};
+
+constexpr A a;
+static_assert(static_cast<bool>(a));
+static_assert((bool)a);
+static_assert(!static_cast<bool>(A{}));
+static_assert(!(bool)A{});
+
+struct B : A {};
+
+constexpr B b;
+static_assert(static_cast<bool>(b));
+static_assert((bool)b);
+static_assert(!static_cast<bool>(B{}));
+static_assert(!(bool)B{});
+
+struct C {
+ template <typename R, typename T>
+ explicit constexpr operator R(this T&&) {
+ return is_lvalue<T>;
+ }
+};
+
+constexpr C c;
+static_assert(static_cast<bool>(c));
+static_assert((bool)c);
+static_assert(!static_cast<bool>(C{}));
+static_assert(!(bool)C{});
+
+struct D {
+ explicit constexpr operator bool(this const D&) { return true; }
+ explicit constexpr operator bool(this const D&&) { return false; }
+};
+
+constexpr D d;
+static_assert(static_cast<bool>(d));
+static_assert((bool)d);
+static_assert(!static_cast<bool>(D{}));
+static_assert(!(bool)D{});