[clang] ade4259 - [clang] Fix parsing a typeid containing a pack indexing expression (#94299)

via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 4 00:34:27 PDT 2024


Author: c8ef
Date: 2024-06-04T09:34:21+02:00
New Revision: ade4259d75d61d4366538b5ee975cac606d43d3c

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

LOG: [clang] Fix parsing a typeid containing a pack indexing expression (#94299)

Fixes #93650

Added: 
    

Modified: 
    clang/lib/AST/Expr.cpp
    clang/test/SemaCXX/cxx2c-pack-indexing.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index ac0b1b38f0162..f9d634550dc06 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -3618,12 +3618,10 @@ bool Expr::HasSideEffects(const ASTContext &Ctx,
   case ConceptSpecializationExprClass:
   case RequiresExprClass:
   case SYCLUniqueStableNameExprClass:
+  case PackIndexingExprClass:
     // These never have a side-effect.
     return false;
 
-  case PackIndexingExprClass:
-    return cast<PackIndexingExpr>(this)->getSelectedExpr()->HasSideEffects(
-        Ctx, IncludePossibleEffects);
   case ConstantExprClass:
     // FIXME: Move this into the "return false;" block above.
     return cast<ConstantExpr>(this)->getSubExpr()->HasSideEffects(

diff  --git a/clang/test/SemaCXX/cxx2c-pack-indexing.cpp b/clang/test/SemaCXX/cxx2c-pack-indexing.cpp
index 28b9765127f4e..9ea90a4c3e30f 100644
--- a/clang/test/SemaCXX/cxx2c-pack-indexing.cpp
+++ b/clang/test/SemaCXX/cxx2c-pack-indexing.cpp
@@ -221,3 +221,13 @@ void f( ) {
 
 
 }
+
+namespace std {
+struct type_info {
+  const char *name;
+};
+} // namespace std
+
+namespace GH93650 {
+auto func(auto... inputArgs) { return typeid(inputArgs...[0]); }
+} // namespace GH93650


        


More information about the cfe-commits mailing list