File tree Expand file tree Collapse file tree 2 files changed +22
-3
lines changed Expand file tree Collapse file tree 2 files changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -75,9 +75,7 @@ InterpFrame::~InterpFrame() {
75
75
if (Func) {
76
76
for (auto &Scope : Func->scopes ()) {
77
77
for (auto &Local : Scope.locals ()) {
78
- Block *B = localBlock (Local.Offset );
79
- if (B->isInitialized ())
80
- B->invokeDtor ();
78
+ S.deallocate (localBlock (Local.Offset ));
81
79
}
82
80
}
83
81
}
Original file line number Diff line number Diff line change @@ -564,6 +564,27 @@ namespace DeleteThis {
564
564
// both-note {{in call to 'super_secret_double_delete()'}}
565
565
}
566
566
567
+ // / FIXME: This is currently diagnosed, but should work.
568
+ // / If the destructor for S is _not_ virtual however, it should fail.
569
+ namespace CastedDelete {
570
+ struct S {
571
+ constexpr S (int *p) : p(p) {}
572
+ constexpr virtual ~S () { *p = 1 ; }
573
+ int *p;
574
+ };
575
+ struct T : S {
576
+ // implicit destructor defined eagerly because it is constexpr and virtual
577
+ using S::S;
578
+ };
579
+
580
+ constexpr int vdtor_1 () {
581
+ int a;
582
+ delete (S*)new T (&a); // expected-note {{delete of pointer to subobject}}
583
+ return a;
584
+ }
585
+ static_assert (vdtor_1() == 1 ); // expected-error {{not an integral constant expression}} \
586
+ // expected-note {{in call to}}
587
+ }
567
588
568
589
#else
569
590
// / Make sure we reject this prior to C++20
You can’t perform that action at this time.
0 commit comments