/// getDecltypeForExpr - Given an expr, will return the decltype for that
/// expression, according to the rules in C++0x [dcl.type.simple]p4
static QualType getDecltypeForExpr(const Expr *e, ASTContext &Context) {
+ if (e->isTypeDependent())
+ return Context.DependentTy;
+
// If e is an id expression or a class member access, decltype(e) is defined
// as the type of the entity named by e.
if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(e)) {
--- /dev/null
+// RUN: clang-cc -fsyntax-only -verify %s -std=c++0x
+
+template<typename T, T t>
+struct TestStruct {
+ typedef decltype(t+2) sum_type;
+};