forked from OSchip/llvm-project
Don't crash with -Wlarge-by-value-copy and a dependent type. PR11726.
llvm-svn: 147812
This commit is contained in:
parent
edb4a8a128
commit
7f21bd74b8
|
@ -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)
|
||||
|
|
|
@ -40,3 +40,8 @@ void g() {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
template<typename T> class DependentPOD {
|
||||
enum b { x };
|
||||
b foo() { return x; }
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue