[cfe-commits] r147812 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/SemaCXX/warn-large-by-value-copy.cpp
Eli Friedman
eli.friedman at gmail.com
Mon Jan 9 15:47:00 PST 2012
Author: efriedma
Date: Mon Jan 9 17:46:59 2012
New Revision: 147812
URL: http://llvm.org/viewvc/llvm-project?rev=147812&view=rev
Log:
Don't crash with -Wlarge-by-value-copy and a dependent type. PR11726.
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/SemaCXX/warn-large-by-value-copy.cpp
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=147812&r1=147811&r2=147812&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Mon Jan 9 17:46:59 2012
@@ -6777,7 +6777,7 @@
// 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 @@
// 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)
Modified: cfe/trunk/test/SemaCXX/warn-large-by-value-copy.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-large-by-value-copy.cpp?rev=147812&r1=147811&r2=147812&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/warn-large-by-value-copy.cpp (original)
+++ cfe/trunk/test/SemaCXX/warn-large-by-value-copy.cpp Mon Jan 9 17:46:59 2012
@@ -40,3 +40,8 @@
}
}
+
+template<typename T> class DependentPOD {
+ enum b { x };
+ b foo() { return x; }
+};
More information about the cfe-commits
mailing list