[clang] f1e78f7 - [clang][Interp] Handle lvalue APValues in visitAPValueInitializer()

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 6 01:25:10 PDT 2024


Author: Timm Bäder
Date: 2024-06-06T10:24:26+02:00
New Revision: f1e78f776908f2bc1759eae25381f576f62728a2

URL: https://github.com/llvm/llvm-project/commit/f1e78f776908f2bc1759eae25381f576f62728a2
DIFF: https://github.com/llvm/llvm-project/commit/f1e78f776908f2bc1759eae25381f576f62728a2.diff

LOG: [clang][Interp] Handle lvalue APValues in visitAPValueInitializer()

Added: 
    

Modified: 
    clang/lib/AST/Interp/ByteCodeExprGen.cpp
    clang/test/CodeGenCXX/template-param-objects-linkage.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Interp/ByteCodeExprGen.cpp b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
index 3671c41ae7039..ea259639dace7 100644
--- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp
+++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
@@ -3188,7 +3188,7 @@ bool ByteCodeExprGen<Emitter>::visitAPValueInitializer(const APValue &Val,
       const APValue &F = Val.getStructField(I);
       const Record::Field *RF = R->getField(I);
 
-      if (F.isInt()) {
+      if (F.isInt() || F.isLValue()) {
         PrimType T = classifyPrim(RF->Decl->getType());
         if (!this->visitAPValue(F, T, E))
           return false;

diff  --git a/clang/test/CodeGenCXX/template-param-objects-linkage.cpp b/clang/test/CodeGenCXX/template-param-objects-linkage.cpp
index 63e7d8c646869..9c148ed83753d 100644
--- a/clang/test/CodeGenCXX/template-param-objects-linkage.cpp
+++ b/clang/test/CodeGenCXX/template-param-objects-linkage.cpp
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++20 %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++20 %s -emit-llvm -o - -fexperimental-new-constant-interpreter | FileCheck %s
 
 struct S { char buf[32]; };
 template<S s> constexpr const char* f() { return s.buf; }


        


More information about the cfe-commits mailing list