When deducing an 'auto' type, don't modify the type-as-written.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180808 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index df09b4b..56c4187 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -1133,16 +1133,14 @@
<< AllocType << TypeRange);
}
Expr *Deduce = Inits[0];
- TypeSourceInfo *DeducedType = 0;
+ QualType DeducedType;
if (DeduceAutoType(AllocTypeInfo, Deduce, DeducedType) == DAR_Failed)
return ExprError(Diag(StartLoc, diag::err_auto_new_deduction_failure)
<< AllocType << Deduce->getType()
<< TypeRange << Deduce->getSourceRange());
- if (!DeducedType)
+ if (DeducedType.isNull())
return ExprError();
-
- AllocTypeInfo = DeducedType;
- AllocType = AllocTypeInfo->getType();
+ AllocType = DeducedType;
}
// Per C++0x [expr.new]p5, the type being constructed may be a