[PATCH] D142630: [clang][Interp] Implement virtual function calls

Timm Bäder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jun 10 23:55:58 PDT 2023


tbaeder added inline comments.


================
Comment at: clang/test/AST/Interp/records.cpp:650
+};
+#endif
----------------
aaron.ballman wrote:
> We should also have test cases for calling virtual functions from within a constructor and a destructor, as that has special semantics. e.g., https://godbolt.org/z/snaj1zfM5
That's broken right now of course. I'l add the test and adjust the expected output. I'll probably have to save a few bits for "things we're currently doing" (like evaluating a constructor), but in a later patch.

FWIW, I expanded your test a bit: https://godbolt.org/z/vq5xT3xvq and it only fails in clang - with a reference:
```
  // CWG issue 1517: we're constructing a base class of the object described by
  // 'This', so that object has not yet begun its period of construction and
  // any polymorphic operation on it results in undefined behavior.
```


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

https://reviews.llvm.org/D142630



More information about the cfe-commits mailing list