diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp index 394e39e99a106..281fb7e14a57d 100644 --- a/clang/lib/AST/ByteCode/Compiler.cpp +++ b/clang/lib/AST/ByteCode/Compiler.cpp @@ -6325,7 +6325,7 @@ bool Compiler::visitDeclRef(const ValueDecl *D, const Expr *E) { if (auto It = Locals.find(D); It != Locals.end()) { const unsigned Offset = It->second.Offset; if (IsReference) - return this->emitGetLocal(PT_Ptr, Offset, E); + return this->emitGetLocal(classifyPrim(E), Offset, E); return this->emitGetPtrLocal(Offset, E); } else if (auto GlobalIndex = P.getGlobal(D)) { if (IsReference) {