Which expressions defeat perfect forwarding, and how should an API handle them?
Show answer and explanation
A forwarding reference preserves a deduced argument's value category, but deduction still needs an expression with a determinate type and bindable form. Braced initializer lists, unresolved overload sets, and some static members or bit-fields cannot be forwarded by a completely generic T&& call without extra type information; the null pointer literal 0 also deduces as an integer rather than as a pointer. Robust APIs add focused overloads such as std::initializer_list, require an explicit cast or typed temporary for ambiguous inputs, copy a bit-field value when appropriate, and avoid hiding important domain conversions behind an unconstrained forwarding overload.
A forwarding reference preserves a deduced argument's value category, but deduction still needs an expression with a determinate type and bindable form. Braced initializer lists, unresolved overload sets, and some static members or bit-fields cannot be forwarded by a completely generic T&& call without extra type information; the null pointer literal 0 also deduces as an integer rather than as a pointer. Robust APIs add focused overloads such as std::initializer_list, require an explicit cast or typed temporary for ambiguous inputs, copy a bit-field value when appropriate, and avoid hiding important domain conversions behind an unconstrained forwarding overload.
Connect the conclusion directly to the type, lifetime, ownership, overload-resolution rule, or library contract present in the question. State implementation dependence or a violated precondition explicitly instead of merely guessing output.