aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaType.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Sema/SemaType.cpp')
-rw-r--r--lib/Sema/SemaType.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index 1bdd7c3b39..ad704685e5 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -1269,6 +1269,12 @@ static bool isArraySizeVLA(Sema &S, Expr *ArraySize, llvm::APSInt &SizeVal) {
S.LangOpts.GNUMode).isInvalid();
}
+/// \brief Determine whether the given type is a POD or standard-layout type,
+/// as appropriate for the C++ language options.
+static bool isPODType(QualType T, ASTContext &Context) {
+ return Context.getLangOpts().CPlusPlus11? T.isCXX11PODType(Context)
+ : T.isCXX98PODType(Context);
+}
/// \brief Build an array type.
///
@@ -1442,8 +1448,8 @@ QualType Sema::BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM,
// Prohibit the use of non-POD types in VLAs.
QualType BaseT = Context.getBaseElementType(T);
if (!T->isDependentType() &&
- !BaseT.isPODType(Context) &&
- !BaseT->isObjCLifetimeType()) {
+ !BaseT->isObjCLifetimeType() &&
+ !isPODType(BaseT, Context)) {
Diag(Loc, diag::err_vla_non_pod)
<< BaseT;
return QualType();