Author: Timm Bäder
Date: 2022-11-11T08:38:06+01:00
New Revision: 7863646fd206952492b9abdbf690be2c4198d728

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

LOG: [clang][Interp] DerivedToBase casts

Differential Revision: https://reviews.llvm.org/D137545

Added: 
    

Modified: 
    clang/lib/AST/Interp/ByteCodeExprGen.cpp
    clang/test/AST/Interp/records.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Interp/ByteCodeExprGen.cpp 
b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
index 91b9809861d8b..b01c428060da5 100644
--- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp
+++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
@@ -107,7 +107,8 @@ bool ByteCodeExprGen<Emitter>::VisitCastExpr(const CastExpr 
*CE) {
         });
   }
 
-  case CK_UncheckedDerivedToBase: {
+  case CK_UncheckedDerivedToBase:
+  case CK_DerivedToBase: {
     if (!this->visit(SubExpr))
       return false;
 

diff  --git a/clang/test/AST/Interp/records.cpp 
b/clang/test/AST/Interp/records.cpp
index d8ac72319c0a2..f49a6736c135b 100644
--- a/clang/test/AST/Interp/records.cpp
+++ b/clang/test/AST/Interp/records.cpp
@@ -245,6 +245,8 @@ namespace MI {
   static_assert(c.a == 10, "");
   static_assert(c.b == 20, "");
 
+  constexpr const A *aPointer = &c;
+  constexpr const B *bPointer = &c;
 
   class D : private A, private B {
     public:


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to