forked from OSchip/llvm-project
[clang][Interp] Handle SubstNonTypeTemplateParmExprs
Differential Revision: https://reviews.llvm.org/D132831
This commit is contained in:
parent
4d700ffe67
commit
5c4dbff0b6
|
@ -231,6 +231,12 @@ bool ByteCodeExprGen<Emitter>::VisitImplicitValueInitExpr(const ImplicitValueIni
|
|||
return false;
|
||||
}
|
||||
|
||||
template <class Emitter>
|
||||
bool ByteCodeExprGen<Emitter>::VisitSubstNonTypeTemplateParmExpr(
|
||||
const SubstNonTypeTemplateParmExpr *E) {
|
||||
return this->visit(E->getReplacement());
|
||||
}
|
||||
|
||||
template <class Emitter>
|
||||
bool ByteCodeExprGen<Emitter>::discard(const Expr *E) {
|
||||
OptionScope<Emitter> Scope(this, /*NewDiscardResult=*/true);
|
||||
|
|
|
@ -76,6 +76,7 @@ public:
|
|||
bool VisitUnaryOperator(const UnaryOperator *E);
|
||||
bool VisitDeclRefExpr(const DeclRefExpr *E);
|
||||
bool VisitImplicitValueInitExpr(const ImplicitValueInitExpr *E);
|
||||
bool VisitSubstNonTypeTemplateParmExpr(const SubstNonTypeTemplateParmExpr *E);
|
||||
|
||||
protected:
|
||||
bool visitExpr(const Expr *E) override;
|
||||
|
|
|
@ -65,3 +65,11 @@ constexpr int recursion(int i) {
|
|||
return recursion(i);
|
||||
}
|
||||
static_assert(recursion(10) == 0, "");
|
||||
|
||||
template<int N = 5>
|
||||
constexpr decltype(N) getNum() {
|
||||
return N;
|
||||
}
|
||||
static_assert(getNum<-2>() == -2, "");
|
||||
static_assert(getNum<10>() == 10, "");
|
||||
static_assert(getNum() == 5, "");
|
||||
|
|
Loading…
Reference in New Issue