Skip to content

Commit c7c6361

Browse files
committed
[clang][Interp] Don't try to decay non-pointers to pointers
1 parent f12655a commit c7c6361

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

clang/lib/AST/Interp/ByteCodeExprGen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4250,7 +4250,7 @@ bool ByteCodeExprGen<Emitter>::visitDeclRef(const ValueDecl *D, const Expr *E) {
42504250
if (E->getType()->isVoidType())
42514251
return true;
42524252
// Convert the dummy pointer to another pointer type if we have to.
4253-
if (PrimType PT = classifyPrim(E); PT != PT_Ptr) {
4253+
if (PrimType PT = classifyPrim(E); PT != PT_Ptr && isPtrType(PT)) {
42544254
if (!this->emitDecayPtr(PT_Ptr, PT, E))
42554255
return false;
42564256
}

clang/test/CXX/temp/temp.res/temp.dep/temp.dep.constexpr/p2-0x.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -std=c++11 -verify %s
1+
// RUN: %clang_cc1 -std=c++11 -verify %s -fexperimental-new-constant-interpreter
22

33
template<int n> struct S; // expected-note 3{{here}}
44

0 commit comments

Comments
 (0)