googletest icon indicating copy to clipboard operation
googletest copied to clipboard

exclude tuple-like types from OnceAction forwarding constructors

Open michaeldleslie opened this issue 2 months ago • 0 comments
trafficstars

Fixes https://github.com/google/googletest/issues/3947

Problem

  • OnceAction has templated forwarding constructors constrained for callable types.
  • On QNX SDK versions prior to 8.0, std::tuple<OnceAction> can incorrectly satisfy those constraints because of how that libc++ implements std::tuple converting constructors.
  • Upstream, most libc++/libstdc++/MSVC versions short-circuit correctly, so the bug is only visible on QNX. But nothing about OnceAction should ever allow a tuple to be treated as a callable.
  • Note existence of QNX downstream patch to achieve the same thing at https://github.com/qnx/googletest/commit/ceebbad256fef7541ab5432d1730427827171cc9#diff-91a00bafe0b6186545af81d16fdc9a5fd0afccfc336bdbbcab5deb7de63a57f6L475

Solution

  • Update OnceAction forwarding constructors to exclude tuple-like types.

michaeldleslie avatar Aug 20 '25 01:08 michaeldleslie