Don't crash with -Wlarge-by-value-copy and a dependent type. PR11726.

llvm-svn: 147812
This commit is contained in:
Eli Friedman 2012-01-09 23:46:59 +00:00
parent edb4a8a128
commit 7f21bd74b8
2 changed files with 7 additions and 2 deletions

View File

@ -6777,7 +6777,7 @@ void Sema::DiagnoseSizeOfParametersAndReturnValue(ParmVarDecl * const *Param,
// Warn if the return value is pass-by-value and larger than the specified
// threshold.
if (ReturnTy.isPODType(Context)) {
if (!ReturnTy->isDependentType() && ReturnTy.isPODType(Context)) {
unsigned Size = Context.getTypeSizeInChars(ReturnTy).getQuantity();
if (Size > LangOpts.NumLargeByValueCopy)
Diag(D->getLocation(), diag::warn_return_value_size)
@ -6788,7 +6788,7 @@ void Sema::DiagnoseSizeOfParametersAndReturnValue(ParmVarDecl * const *Param,
// threshold.
for (; Param != ParamEnd; ++Param) {
QualType T = (*Param)->getType();
if (!T.isPODType(Context))
if (T->isDependentType() || !T.isPODType(Context))
continue;
unsigned Size = Context.getTypeSizeInChars(T).getQuantity();
if (Size > LangOpts.NumLargeByValueCopy)

View File

@ -40,3 +40,8 @@ void g() {
}
}
template<typename T> class DependentPOD {
enum b { x };
b foo() { return x; }
};