[PATCH] D57097: Make llvm::Optional<T> trivially copyable when T is trivially copyable

Chandler Carruth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 6 23:15:47 PST 2019


chandlerc added a comment.

I think you may be able to do this in a slightly nicer way.

If you move the definitions of the relevant special member functions to be out-of-line, I think you can remove the class-level specialization entirely, and simply explicitly specialize (out-of-line) the definitions of the relevant special member functions, with the trivial case specializing them to `= default` definitions, and the non-trivial case specializing to their current definitions. Make sense?

My only concern is that I think there were some dark corner cases around defined-as-defaulted but not declared-as-defaulted. I don't know if they impact triviality in ways that cause problems.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D57097





More information about the llvm-commits mailing list