[libcxx-commits] [PATCH] D80482: [libcxx] Fix C++14 and up constexpr members in MoveOnly.

Zoe Carver via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon May 25 11:14:48 PDT 2020


zoecarver marked an inline comment as done.
zoecarver added inline comments.


================
Comment at: libcxx/test/support/MoveOnly.h:36
     constexpr bool operator< (const MoveOnly& x) const {return data_ <  x.data_;}
-    constexpr MoveOnly operator+(const MoveOnly& x) const { return MoveOnly{data_ + x.data_}; }
-    constexpr MoveOnly operator*(const MoveOnly& x) const { return MoveOnly{data_ * x.data_}; }
+    TEST_CONSTEXPR_CXX14 MoveOnly operator+(const MoveOnly& x) const
+        { return MoveOnly{data_ + x.data_}; }
----------------
ldionne wrote:
> I think those should be OK in C++11, no? It's only a single return statement.
No, unfortunately not. They both call the move constructor which isn't constexpr. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80482





More information about the libcxx-commits mailing list