[clang] [clang][Sema] Track trivial-relocatability as a type trait (PR #84621)

via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 5 09:17:01 PDT 2024


cor3ntin wrote:

> The semantics in this PR are the semantics relied upon by the libraries whose maintainers have commented in support of this PR. These semantics have been codified into P1144; that's the paper I'm quoting in the code comments. @cor3ntin could you clarify what you mean by "do as P2786 does" and "stupid types"? Are you talking about types like `pair<K&, V&>`? If that kind of "stupid type" is reported as trivially relocatable, then `fbvector` and `q_rotate` would mis-compile operations on it, so Folly and Qt would remain unable to use Clang's builtin.

I apologize, this wasn't a useful/constructive description. I meant types that are copyable and not assignable, which as several people pointed out, does indeed include all sort of reference wrapper. These types are still copyable and any restriction to make them not relocatable would be extremely artificial (and an additional requirements can be put on a library wrapper to achieve that design if anyone wanted it) 

https://github.com/llvm/llvm-project/pull/84621


More information about the cfe-commits mailing list