aaron.ballman added inline comments.
================ Comment at: clang/lib/AST/Interp/Interp.cpp:221-225 + if (const Function *Func = S.Current->getFunction(); + Func && (Func->isConstructor() || Func->isDestructor())) { + if (Ptr.block() == S.Current->getThis().block()) + return true; } ---------------- Combining predicates; NFC ================ Comment at: clang/test/AST/Interp/cxx20.cpp:221-230 + class FooDtor { + int a; + public: + constexpr FooDtor() { + this->a = 10; + } + constexpr ~FooDtor() { ---------------- I'd feel more comfortable if we had some way to validate that the write to `a` in both of these cases actually caused the correct value to appear in `a`. We're just validating that this compiles and doesn't crash, but we're not validating that the actual behavior occurs. How about adding tests like: ``` template <bool Good> struct ctor_test { int a = 0; constexpr ctor_test() { if (Good) a = 10; int local = 100 / a; } }; template <bool Good> struct dtor_test { int a = 0; constexpr dtor_test() = default; constexpr ~dtor_test() { if (Good) a = 10; int local = 100 / a; } }; constexpr ctor_test<true> good_ctor; constexpr dtor_test<true> good_dtor; constexpr ctor_test<false> bad_ctor; constexpr dtor_test<false> bad_dtor; ``` 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