[PATCH] D18823: Implementation of VlA of GNU C++ extension

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 13 13:49:08 PDT 2016


rsmith added inline comments.

================
Comment at: llvm/tools/clang/lib/Sema/SemaType.cpp:2163-2165
@@ -2161,3 +2162,5 @@
       if (!T->isDependentType() && isCompleteType(Loc, BaseT) &&
-          !BaseT.isPODType(Context) && !BaseT->isObjCLifetimeType()) {
+          RD && !RD->hasDefaultConstructor() &&
+          !BaseT->isObjCLifetimeType()) {
         Diag(Loc, diag::err_vla_non_pod) << BaseT;
+          return QualType();
----------------
Why reject types without default constructors? That's something SemaInit should be checking for, not the responsibility of this code. If we really need to reject them here for some reason, a "non-POD" error is not the right way to diagnose it.


http://reviews.llvm.org/D18823





More information about the cfe-commits mailing list