aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2011-06-13 06:37:03 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2011-06-13 06:37:03 +0000
commitdb11b0187bafe77263036eafc3977fa5da3bcf1a (patch)
treebc30cd91b675c1852e9ef6ef54d5570f873259ab /lib/Sema/SemaExpr.cpp
parent0e1e69ca1b30df7692f302a5388377f507bc4567 (diff)
Give a diagnostic when using non-POD types in a va_arg
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132905 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExpr.cpp')
-rw-r--r--lib/Sema/SemaExpr.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 0549e94995..a44b4475ce 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -9819,7 +9819,11 @@ ExprResult Sema::BuildVAArgExpr(SourceLocation BuiltinLoc,
}
// FIXME: Check that type is complete/non-abstract
- // FIXME: Warn if a non-POD type is passed in.
+
+ if (!TInfo->getType()->isDependentType() && !TInfo->getType()->isPODType())
+ return ExprError(Diag(TInfo->getTypeLoc().getBeginLoc(),
+ diag::warn_second_parameter_to_va_arg_not_pod)
+ << TInfo->getType() << TInfo->getTypeLoc().getSourceRange());
QualType T = TInfo->getType().getNonLValueExprType(Context);
return Owned(new (Context) VAArgExpr(BuiltinLoc, E, TInfo, RPLoc, T));