forked from OSchip/llvm-project
parent
110377c669
commit
8af7837b08
|
@ -615,6 +615,7 @@ namespace {
|
|||
OwningExprResult VisitUnaryOperator(UnaryOperator *E);
|
||||
OwningExprResult VisitBinaryOperator(BinaryOperator *E);
|
||||
OwningExprResult VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E);
|
||||
OwningExprResult VisitConditionalOperator(ConditionalOperator *E);
|
||||
OwningExprResult VisitSizeOfAlignOfExpr(SizeOfAlignOfExpr *E);
|
||||
OwningExprResult VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E);
|
||||
OwningExprResult VisitImplicitCastExpr(ImplicitCastExpr *E);
|
||||
|
@ -823,6 +824,34 @@ TemplateExprInstantiator::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E) {
|
|||
return move(Result);
|
||||
}
|
||||
|
||||
Sema::OwningExprResult
|
||||
TemplateExprInstantiator::VisitConditionalOperator(ConditionalOperator *E) {
|
||||
Sema::OwningExprResult Cond = Visit(E->getCond());
|
||||
if (Cond.isInvalid())
|
||||
return SemaRef.ExprError();
|
||||
|
||||
// FIXME: use getLHS() and cope with NULLness
|
||||
Sema::OwningExprResult True = Visit(E->getTrueExpr());
|
||||
if (True.isInvalid())
|
||||
return SemaRef.ExprError();
|
||||
|
||||
Sema::OwningExprResult False = Visit(E->getFalseExpr());
|
||||
if (False.isInvalid())
|
||||
return SemaRef.ExprError();
|
||||
|
||||
Sema::OwningExprResult Result
|
||||
= SemaRef.ActOnConditionalOp(E->getCond()->getLocEnd(),
|
||||
E->getFalseExpr()->getLocStart(),
|
||||
move(Cond), move(True), move(False));
|
||||
if (Result.isInvalid())
|
||||
return SemaRef.ExprError();
|
||||
|
||||
/* Cond.release();
|
||||
True.release();
|
||||
False.release();*/
|
||||
return move(Result);
|
||||
}
|
||||
|
||||
Sema::OwningExprResult
|
||||
TemplateExprInstantiator::VisitSizeOfAlignOfExpr(SizeOfAlignOfExpr *E) {
|
||||
bool isSizeOf = E->isSizeOf();
|
||||
|
@ -832,7 +861,7 @@ TemplateExprInstantiator::VisitSizeOfAlignOfExpr(SizeOfAlignOfExpr *E) {
|
|||
if (T->isDependentType()) {
|
||||
T = SemaRef.InstantiateType(T, TemplateArgs, NumTemplateArgs,
|
||||
/*FIXME*/E->getOperatorLoc(),
|
||||
&SemaRef.PP.getIdentifierTable().get("sizeof"));
|
||||
&SemaRef.PP.getIdentifierTable().get("sizeof"));
|
||||
if (T.isNull())
|
||||
return SemaRef.ExprError();
|
||||
}
|
||||
|
|
|
@ -65,3 +65,37 @@ void test_unary_op_overload(A<8> *a8) {
|
|||
typedef N4::UnaryOpOverload<N3::Z>::type UZ;
|
||||
UZ *uz = a8;
|
||||
}
|
||||
|
||||
/*
|
||||
namespace N5 {
|
||||
template<int I>
|
||||
struct Lookup {
|
||||
enum { val = I, more = val + 1 };
|
||||
};
|
||||
|
||||
template<bool B>
|
||||
struct Cond {
|
||||
enum Junk { is = B ? Lookup<B>::more : Lookup<Lookup<B+1>::more>::val };
|
||||
};
|
||||
|
||||
enum { resultT = Cond<true>::is,
|
||||
resultF = Cond<false>::is };
|
||||
}
|
||||
*/
|
||||
|
||||
namespace N6 {
|
||||
template<int I>
|
||||
struct Lookup {
|
||||
};
|
||||
|
||||
template<bool B, typename T, typename E>
|
||||
struct Cond {
|
||||
typedef Lookup<B ? sizeof(T) : sizeof(E)> True;
|
||||
typedef Lookup<!B ? sizeof(T) : sizeof(E)> False;
|
||||
};
|
||||
|
||||
typedef Cond<true, int, char>::True True;
|
||||
typedef Cond<false, int, char>::False False;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue