shafik added inline comments.

================
Comment at: clang/lib/AST/Interp/Interp.cpp:264-270
+  const Function *Func = S.Current->getFunction();
+  if (Func && Func->isConstructor()) {
+    // The This pointer is writable in constructors, even if
+    // isConst() returns true.
+    if (Ptr.block() == S.Current->getThis().block())
+      return true;
+  }
----------------
shafik wrote:
> tbaeder wrote:
> > aaron.ballman wrote:
> > > The same is true for destructors as well: https://godbolt.org/z/a49aEErz8
> > Oh, good catch, thanks.
> Interesting case: https://godbolt.org/z/5r5fdh9jr
> 
> Implementation divergence, have to figure out who is correct here.
I believe clang is correct: https://eel.is/c++draft/expr.const#4.8


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

https://reviews.llvm.org/D136751

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

Reply via email to