PiotrZSL added a comment.

In D144217#4143540 <https://reviews.llvm.org/D144217#4143540>, @carlosgalvezp 
wrote:

>> Perhaps, this can even be generalized to all types whose size() and empty() 
>> are constexpr.

Problem is that you can mark function constexpr, but it doesnt need to be 
constexpr evaluated:

  struct C
  {
      constexpr C(int v) : v(v) {}
      constexpr int size() const { return v; };
      constexpr bool empty() const { return v == 0; };
      constexpr void setSize(int vv) { v = vv; };
      int v;
  };
  
  constexpr C value(6);
  C non_const(6);

I would need to check if it's constexpr evaluated, but here we don't evaluate 
it. Alternative would be to check if method use only template arguments, but 
then it could use other const static or something...
This is why I decided to go with config. And still you may have other user 
provided classes that does not have empty/size constexpr.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D144217

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to