Skip to content

Commit 719e077

Browse files
committed
[clang][Interp] Handle PackIndexExprs
1 parent 1411452 commit 719e077

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

clang/lib/AST/Interp/ByteCodeExprGen.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2226,6 +2226,12 @@ bool ByteCodeExprGen<Emitter>::VisitPseudoObjectExpr(
22262226
return true;
22272227
}
22282228

2229+
template <class Emitter>
2230+
bool ByteCodeExprGen<Emitter>::VisitPackIndexingExpr(
2231+
const PackIndexingExpr *E) {
2232+
return this->delegate(E->getSelectedExpr());
2233+
}
2234+
22292235
template <class Emitter> bool ByteCodeExprGen<Emitter>::discard(const Expr *E) {
22302236
if (E->containsErrors())
22312237
return false;

clang/lib/AST/Interp/ByteCodeExprGen.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ class ByteCodeExprGen : public ConstStmtVisitor<ByteCodeExprGen<Emitter>, bool>,
119119
bool VisitConceptSpecializationExpr(const ConceptSpecializationExpr *E);
120120
bool VisitCXXRewrittenBinaryOperator(const CXXRewrittenBinaryOperator *E);
121121
bool VisitPseudoObjectExpr(const PseudoObjectExpr *E);
122+
bool VisitPackIndexingExpr(const PackIndexingExpr *E);
122123

123124
protected:
124125
bool visitExpr(const Expr *E) override;

clang/test/AST/Interp/cxx23.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,12 @@ int test_in_lambdas() {
137137
// all-note {{in call to}}
138138
return 0;
139139
}
140+
141+
/// PackIndexExpr.
142+
template <auto... p>
143+
struct check_ice {
144+
enum e {
145+
x = p...[0] // all-warning {{is a C++2c extension}}
146+
};
147+
};
148+
static_assert(check_ice<42>::x == 42);

0 commit comments

Comments
 (0)