forked from OSchip/llvm-project
Template instantiation for GNU statement expressions
llvm-svn: 72129
This commit is contained in:
parent
115652db4a
commit
8d7fef3cf2
|
@ -54,6 +54,8 @@ namespace {
|
|||
OwningExprResult VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E);
|
||||
OwningExprResult VisitCXXConditionDeclExpr(CXXConditionDeclExpr *E);
|
||||
OwningExprResult VisitConditionalOperator(ConditionalOperator *E);
|
||||
// FIXME: AddrLabelExpr
|
||||
OwningExprResult VisitStmtExpr(StmtExpr *E);
|
||||
OwningExprResult VisitSizeOfAlignOfExpr(SizeOfAlignOfExpr *E);
|
||||
OwningExprResult VisitUnresolvedDeclRefExpr(UnresolvedDeclRefExpr *E);
|
||||
OwningExprResult VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E);
|
||||
|
@ -453,6 +455,16 @@ TemplateExprInstantiator::VisitConditionalOperator(ConditionalOperator *E) {
|
|||
move(Cond), move(LHS), move(RHS));
|
||||
}
|
||||
|
||||
Sema::OwningExprResult TemplateExprInstantiator::VisitStmtExpr(StmtExpr *E) {
|
||||
Sema::OwningStmtResult SubStmt = SemaRef.InstantiateStmt(E->getSubStmt(),
|
||||
TemplateArgs);
|
||||
if (SubStmt.isInvalid())
|
||||
return SemaRef.ExprError();
|
||||
|
||||
return SemaRef.ActOnStmtExpr(E->getLParenLoc(), move(SubStmt),
|
||||
E->getRParenLoc());
|
||||
}
|
||||
|
||||
Sema::OwningExprResult
|
||||
TemplateExprInstantiator::VisitSizeOfAlignOfExpr(SizeOfAlignOfExpr *E) {
|
||||
bool isSizeOf = E->isSizeOf();
|
||||
|
|
|
@ -56,3 +56,16 @@ struct Conditional0 {
|
|||
};
|
||||
|
||||
template struct Conditional0<int, int, int>;
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// Statement expressions
|
||||
// ---------------------------------------------------------------------
|
||||
template<typename T>
|
||||
struct StatementExpr0 {
|
||||
void f(T t) {
|
||||
(void)({ if (t) t = t + 17; }); // expected-error{{invalid}}
|
||||
}
|
||||
};
|
||||
|
||||
template struct StatementExpr0<int>;
|
||||
template struct StatementExpr0<N1::X>; // expected-note{{instantiation}}
|
||||
|
|
Loading…
Reference in New Issue