Skip to content

Commit fbd643f

Browse files
committed
[clang][Interp] Don't try to activate root pointers
No inline descriptor means we can't do that.
1 parent 84729c9 commit fbd643f

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

clang/lib/AST/Interp/Interp.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,17 +1335,19 @@ inline bool GetPtrThisBase(InterpState &S, CodePtr OpPC, uint32_t Off) {
13351335

13361336
inline bool FinishInitPop(InterpState &S, CodePtr OpPC) {
13371337
const Pointer &Ptr = S.Stk.pop<Pointer>();
1338-
if (Ptr.canBeInitialized())
1338+
if (Ptr.canBeInitialized()) {
13391339
Ptr.initialize();
1340-
Ptr.activate();
1340+
Ptr.activate();
1341+
}
13411342
return true;
13421343
}
13431344

13441345
inline bool FinishInit(InterpState &S, CodePtr OpPC) {
13451346
const Pointer &Ptr = S.Stk.peek<Pointer>();
1346-
if (Ptr.canBeInitialized())
1347+
if (Ptr.canBeInitialized()) {
13471348
Ptr.initialize();
1348-
Ptr.activate();
1349+
Ptr.activate();
1350+
}
13491351
return true;
13501352
}
13511353

clang/test/AST/Interp/cxx98.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,7 @@ _Static_assert(c0_test == 0, "");
5050
int a = 0; // both-note {{declared here}}
5151
_Static_assert(a == 0, ""); // both-error {{static assertion expression is not an integral constant expression}} \
5252
// both-note {{read of non-const variable 'a' is not allowed in a constant expression}}
53+
54+
struct SelfReference { SelfReference &r; };
55+
extern SelfReference self_reference_1;
56+
SelfReference self_reference_2 = {self_reference_1};

0 commit comments

Comments
 (0)