[libcxx-commits] [PATCH] D116570: [libc++] Eliminate the `__function_like` helper.

Konstantin Varlamov via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jan 4 09:42:17 PST 2022


var-const added a comment.

(quoting comments from the previous discussion in the other patch)

> Whichever one we choose, the user might (accidentally or on purpose) end up relying on it. They'll have some template that does one thing if the type is copyable and a different thing if it's not, and then boom, technically we can't change that without an ABI break.

True, but since we have to choose, it seems like forbidding operations that aren't explicitly supported prevents more common cases of misuse than allowing them. Somebody accidentally copying a function object seems more likely to happen than a template switching on copyability.

> we actually can change this stuff without worrying about the breakage to users.

I think there are two different considerations here: whether the Standard allows us to change these things (yes) and whether these changes would provide good user experience (that is, avoid breaking anybody or at least break as few people as possible).

> FWIW, today, GCC accepts and MSVC rejects https://godbolt.org/z/hhae7zEf9

MSVC derives the function objects from a helper class `_Not_quite_object` which is similar to `__function_like` in intention. GCC doesn't do anything like that, AFAICS.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116570/new/

https://reviews.llvm.org/D116570



More information about the libcxx-commits mailing list