The canonical type of typeof or decltype with a dependent type is itself,
not Context.DependentTy. I'll let Anders check in the test case for this one...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74975 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index c59a5d7..de4816c 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -1901,8 +1901,13 @@
/// DeclRefExpr's. This doesn't effect the type checker, since it operates
/// on canonical type's (which are always unique).
QualType ASTContext::getTypeOfExprType(Expr *tofExpr) {
- QualType Canonical = getCanonicalType(tofExpr->getType());
- TypeOfExprType *toe = new (*this,8) TypeOfExprType(tofExpr, Canonical);
+ TypeOfExprType *toe;
+ if (tofExpr->isTypeDependent())
+ toe = new (*this, 8) TypeOfExprType(tofExpr);
+ else {
+ QualType Canonical = getCanonicalType(tofExpr->getType());
+ toe = new (*this,8) TypeOfExprType(tofExpr, Canonical);
+ }
Types.push_back(toe);
return QualType(toe, 0);
}
@@ -1957,8 +1962,13 @@
/// an issue. This doesn't effect the type checker, since it operates
/// on canonical type's (which are always unique).
QualType ASTContext::getDecltypeType(Expr *e) {
- QualType T = getDecltypeForExpr(e, *this);
- DecltypeType *dt = new (*this, 8) DecltypeType(e, getCanonicalType(T));
+ DecltypeType *dt;
+ if (e->isTypeDependent()) // FIXME: canonicalize the expression
+ dt = new (*this, 8) DecltypeType(e);
+ else {
+ QualType T = getDecltypeForExpr(e, *this);
+ dt = new (*this, 8) DecltypeType(e, getCanonicalType(T));
+ }
Types.push_back(dt);
return QualType(dt, 0);
}