diff --git a/clang/lib/AST/Interp/ByteCodeExprGen.cpp b/clang/lib/AST/Interp/ByteCodeExprGen.cpp index c0721b0daf9a3..a93635a9f6888 100644 --- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp +++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp @@ -1940,6 +1940,12 @@ bool ByteCodeExprGen::VisitSizeOfPackExpr(const SizeOfPackExpr *E) { return this->emitConst(E->getPackLength(), E); } +template +bool ByteCodeExprGen::VisitGenericSelectionExpr( + const GenericSelectionExpr *E) { + return this->delegate(E->getResultExpr()); +} + template bool ByteCodeExprGen::discard(const Expr *E) { if (E->containsErrors()) return false; diff --git a/clang/lib/AST/Interp/ByteCodeExprGen.h b/clang/lib/AST/Interp/ByteCodeExprGen.h index ec88f31ae516a..1710b4446432b 100644 --- a/clang/lib/AST/Interp/ByteCodeExprGen.h +++ b/clang/lib/AST/Interp/ByteCodeExprGen.h @@ -108,6 +108,7 @@ class ByteCodeExprGen : public ConstStmtVisitor, bool>, bool VisitOffsetOfExpr(const OffsetOfExpr *E); bool VisitCXXScalarValueInitExpr(const CXXScalarValueInitExpr *E); bool VisitSizeOfPackExpr(const SizeOfPackExpr *E); + bool VisitGenericSelectionExpr(const GenericSelectionExpr *E); protected: bool visitExpr(const Expr *E) override; diff --git a/clang/test/Sema/c2x-auto.c b/clang/test/Sema/c2x-auto.c index 7cbd1db31315a..97754b2fb836b 100644 --- a/clang/test/Sema/c2x-auto.c +++ b/clang/test/Sema/c2x-auto.c @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -std=c2x -verify -pedantic -Wno-comments %s +// RUN: %clang_cc1 -std=c2x -verify -pedantic -Wno-comments %s -fexperimental-new-constant-interpreter void test_basic_types(void) { auto undefined; // expected-error {{declaration of variable 'undefined' with deduced type 'auto' requires an initializer}} diff --git a/clang/test/Sema/c2x-bool.c b/clang/test/Sema/c2x-bool.c index 0bc147228fda4..98cb8507359d0 100644 --- a/clang/test/Sema/c2x-bool.c +++ b/clang/test/Sema/c2x-bool.c @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -std=c2x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c2x -fsyntax-only -verify %s -fexperimental-new-constant-interpreter _Static_assert(_Generic(true, _Bool : 1, default: 0)); _Static_assert(_Generic(false, _Bool : 1, default: 0));