[clang][Interp] Support GenericSelectionExprs
Just delegate to the resulting expression.
This commit is contained in:
parent
fa98e2861d
commit
48f8b74c35
@ -1940,6 +1940,12 @@ bool ByteCodeExprGen<Emitter>::VisitSizeOfPackExpr(const SizeOfPackExpr *E) {
|
||||
return this->emitConst(E->getPackLength(), E);
|
||||
}
|
||||
|
||||
template <class Emitter>
|
||||
bool ByteCodeExprGen<Emitter>::VisitGenericSelectionExpr(
|
||||
const GenericSelectionExpr *E) {
|
||||
return this->delegate(E->getResultExpr());
|
||||
}
|
||||
|
||||
template <class Emitter> bool ByteCodeExprGen<Emitter>::discard(const Expr *E) {
|
||||
if (E->containsErrors())
|
||||
return false;
|
||||
|
@ -108,6 +108,7 @@ public:
|
||||
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;
|
||||
|
@ -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}}
|
||||
|
@ -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));
|
||||
|
Loading…
x
Reference in New Issue
Block a user