forked from OSchip/llvm-project
Decltype needs to have a dependent type if the expr passed to it is type dependent. Fixes PR4444.
llvm-svn: 74175
This commit is contained in:
parent
1a20d2ab98
commit
7d209570b6
|
@ -1666,6 +1666,9 @@ QualType ASTContext::getTypeOfType(QualType tofType) {
|
|||
/// 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)) {
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
// RUN: clang-cc -fsyntax-only -verify %s -std=c++0x
|
||||
|
||||
template<typename T, T t>
|
||||
struct TestStruct {
|
||||
typedef decltype(t+2) sum_type;
|
||||
};
|
Loading…
Reference in New Issue