Skip to content

Commit 4447461

Browse files
committed
[clang][Interp] Don't try to dereference a null type
1 parent 7a28a5b commit 4447461

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

clang/lib/AST/Interp/ByteCodeExprGen.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2672,6 +2672,9 @@ bool ByteCodeExprGen<Emitter>::delegate(const Expr *E) {
26722672
}
26732673

26742674
template <class Emitter> bool ByteCodeExprGen<Emitter>::visit(const Expr *E) {
2675+
if (E->getType().isNull())
2676+
return false;
2677+
26752678
if (E->getType()->isVoidType())
26762679
return this->discard(E);
26772680

clang/test/SemaCXX/recovery-expr-type.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// RUN: %clang_cc1 -triple=x86_64-unknown-unknown -o - %s -std=gnu++17 -fsyntax-only -verify -fexperimental-new-constant-interpreter
2+
// RUN: %clang_cc1 -triple=x86_64-unknown-unknown -o - %s -std=gnu++20 -fsyntax-only -verify -fexperimental-new-constant-interpreter
13
// RUN: %clang_cc1 -triple=x86_64-unknown-unknown -o - %s -std=gnu++17 -fsyntax-only -verify
24
// RUN: %clang_cc1 -triple=x86_64-unknown-unknown -o - %s -std=gnu++20 -fsyntax-only -verify
35

0 commit comments

Comments
 (0)