[clang] c7c6361 - [clang][Interp] Don't try to decay non-pointers to pointers
Timm Bäder via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 21 04:15:51 PDT 2024
Author: Timm Bäder
Date: 2024-06-21T13:15:35+02:00
New Revision: c7c636189adc45251be2b7cc53b6b047e1ac3536
URL: https://github.com/llvm/llvm-project/commit/c7c636189adc45251be2b7cc53b6b047e1ac3536
DIFF: https://github.com/llvm/llvm-project/commit/c7c636189adc45251be2b7cc53b6b047e1ac3536.diff
LOG: [clang][Interp] Don't try to decay non-pointers to pointers
Added:
Modified:
clang/lib/AST/Interp/ByteCodeExprGen.cpp
clang/test/CXX/temp/temp.res/temp.dep/temp.dep.constexpr/p2-0x.cpp
Removed:
################################################################################
diff --git a/clang/lib/AST/Interp/ByteCodeExprGen.cpp b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
index 034e479ff3a32..edc2ec8e50952 100644
--- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp
+++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
@@ -4250,7 +4250,7 @@ bool ByteCodeExprGen<Emitter>::visitDeclRef(const ValueDecl *D, const Expr *E) {
if (E->getType()->isVoidType())
return true;
// Convert the dummy pointer to another pointer type if we have to.
- if (PrimType PT = classifyPrim(E); PT != PT_Ptr) {
+ if (PrimType PT = classifyPrim(E); PT != PT_Ptr && isPtrType(PT)) {
if (!this->emitDecayPtr(PT_Ptr, PT, E))
return false;
}
diff --git a/clang/test/CXX/temp/temp.res/temp.dep/temp.dep.constexpr/p2-0x.cpp b/clang/test/CXX/temp/temp.res/temp.dep/temp.dep.constexpr/p2-0x.cpp
index 11dd5194192be..a63ffa92d726a 100644
--- a/clang/test/CXX/temp/temp.res/temp.dep/temp.dep.constexpr/p2-0x.cpp
+++ b/clang/test/CXX/temp/temp.res/temp.dep/temp.dep.constexpr/p2-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++11 -verify %s
+// RUN: %clang_cc1 -std=c++11 -verify %s -fexperimental-new-constant-interpreter
template<int n> struct S; // expected-note 3{{here}}
More information about the cfe-commits
mailing list