Tyker added a comment.

The now that constexpr destructors are legal. The code in this patch need to be 
adapted, I have question about the following code.

  struct A {
    constexpr ~A() {}
  };
  
  consteval A f() {
      return A{};
  }
  
  void test() {
      A a;
      a = f(); // <-- here
  }

At the point i marked.
The invocation of f causes an immediate invocation 
(http://eel.is/c++draft/expr.const#12).
Immediate invocation are full expression 
(http://eel.is/c++draft/intro.execution#5).
Full expression resolve all there side-effects before evaluating the next full 
expression (http://eel.is/c++draft/intro.execution#9).
The return value of f() is created inside the immediate invocation.
So the destructor of the value returned by f() should be destroyed within the 
immediate evaluation.
But that value is needed for the assignment operator.
This seem contradictory. What have i misunderstood ? What should happen here ?


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

https://reviews.llvm.org/D63960



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

Reply via email to