]> granicus.if.org Git - clang/commitdiff
Remove support for arrays of runtime bound in C++1y, now they have been voted
authorRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 1 Oct 2013 00:19:43 +0000 (00:19 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 1 Oct 2013 00:19:43 +0000 (00:19 +0000)
out of the working paper. This reverts r179962 and r179992.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191718 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/DiagnosticSemaKinds.td
lib/Sema/SemaStmt.cpp
lib/Sema/SemaType.cpp
test/SemaCXX/cxx1y-array-runtime-bound.cpp [deleted file]
test/SemaCXX/cxx98-compat-pedantic.cpp

index 2dd7ea7c01d12a25bf2c8f2c0deb5ad96545bbbf..014cce37f414e2101866fb20e4990f6b5e46ef16 100644 (file)
@@ -83,9 +83,6 @@ def ext_vla : Extension<"variable length arrays are a C99 feature">,
   InGroup<VLAExtension>;
 def warn_vla_used : Warning<"variable length array used">,
   InGroup<VLA>, DefaultIgnore;
-def warn_cxx11_compat_array_of_runtime_bound : Warning<
-  "arrays of runtime bound are incompatible with C++ standards before C++1y">,
-  InGroup<CXXPre1yCompatPedantic>, DefaultIgnore;
 def err_vla_non_pod : Error<"variable length array of non-POD element type %0">;
 def err_vla_in_sfinae : Error<
   "variable length array cannot be formed during template argument deduction">;
index 136a5e169d923bb0d4ca369cc1e091a5595a55bb..10e808eae3175a0b96b29d0769267594aeb26c76 100644 (file)
@@ -2102,8 +2102,6 @@ Sema::BuildCXXForRangeStmt(SourceLocation ForLoc, SourceLocation ColonLoc,
                                                  RangeLoc));
       else if (const VariableArrayType *VAT =
                dyn_cast<VariableArrayType>(UnqAT))
-        // FIXME: Need to build an OpaqueValueExpr for this rather than
-        // recomputing it!
         BoundExpr = VAT->getSizeExpr();
       else {
         // Can't be a DependentSizedArrayType or an IncompleteArrayType since
index 839ca7eca7c5a08c0960c1ae5cd2fb6dc3ea5449..accf2fdcaf6e0e7b101f9aa322659e2bddc372ae 100644 (file)
@@ -1612,7 +1612,6 @@ QualType Sema::BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM,
   if (!getLangOpts().C99) {
     if (T->isVariableArrayType()) {
       // Prohibit the use of non-POD types in VLAs.
-      // FIXME: C++1y allows this.
       QualType BaseT = Context.getBaseElementType(T);
       if (!T->isDependentType() &&
           !BaseT.isPODType(Context) &&
@@ -1628,9 +1627,7 @@ QualType Sema::BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM,
       }
       // Just extwarn about VLAs.
       else
-        Diag(Loc, getLangOpts().CPlusPlus1y
-                      ? diag::warn_cxx11_compat_array_of_runtime_bound
-                      : diag::ext_vla);
+        Diag(Loc, diag::ext_vla);
     } else if (ASM != ArrayType::Normal || Quals != 0)
       Diag(Loc,
            getLangOpts().CPlusPlus? diag::err_c99_array_usage_cxx
diff --git a/test/SemaCXX/cxx1y-array-runtime-bound.cpp b/test/SemaCXX/cxx1y-array-runtime-bound.cpp
deleted file mode 100644 (file)
index 1643adb..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-// RUN: %clang_cc1 -std=c++1y %s -verify -triple=x86_64-linux-gnu -pedantic-errors
-
-// FIXME: many diagnostics here say 'variably modified type'.
-//        catch this case and say 'array of runtime bound' instead.
-
-namespace std { struct type_info; }
-
-struct S {
-  int arr[__SIZE_MAX__ / 32];
-};
-S s[32]; // expected-error {{array is too large}}
-
-int n;
-int a[n]; // expected-error {{not allowed at file scope}}
-
-struct T {
-  int a[n]; // expected-error {{fields must have a constant size}}
-  static int b[n]; // expected-error {{not allowed at file scope}}
-};
-
-int g(int n, int a[n]);
-
-template<typename T> struct X {};
-template<int N, int[N]> struct Y {};
-template<int[n]> struct Z {}; // expected-error {{of variably modified type}}
-
-int f(int n) {
-  int arb[n]; // expected-note 3{{here}}
-  [arb] {} (); // expected-error {{cannot be captured}}
-
-  // FIXME: an array of runtime bound can be captured by reference.
-  [&arb] { // expected-error {{cannot be captured}}
-    // Capturing the array implicitly captures the bound, if we need it
-    // in a range-based for loop.
-    for (auto &n : arb) { } // expected-error {{cannot be captured}}
-  } ();
-
-  X<int[n]> x; // expected-error {{variably modified type}}
-
-  int arb_neg[-1]; // expected-error {{negative size}}
-  int arb_of_array[n][2];
-  int arr[3] = { 1, 2, 3, 4 }; // expected-error {{excess elements}}
-  char foo[4] = "fool"; // expected-error {{initializer-string for char array is too long}}
-
-  static int not_auto1[n]; // expected-error {{can not have 'static'}}
-  extern int not_auto2[n]; // expected-error {{can not have 'extern'}}
-  // FIXME: say 'thread_local' not 'static'.
-  thread_local int not_auto1[n]; // expected-error {{can not have 'static'}}
-
-  // FIXME: these should all be invalid.
-  auto &&ti1 = typeid(arb);
-  auto &&ti2 = typeid(int[n]);
-  auto &&so1 = sizeof(arb);
-  auto &&so2 = sizeof(int[n]);
-  auto *p = &arb;
-  decltype(arb) arb2;
-  int (*arbp)[n] = 0;
-  const int (&arbr)[n] = arbr; // expected-warning {{not yet bound}}
-  typedef int arbty[n];
-  int array_of_arb[2][n];
-
-  struct Dyn { Dyn() {} Dyn(int) {} ~Dyn() {} };
-
-  // FIXME: these should be valid.
-  int arb_dynamic[n] = { 1, 2, 3, 4 }; // expected-error {{may not be initialized}}
-  Dyn dyn[n]; // expected-error {{non-POD}}
-  Dyn dyn_init[n] = { 1, 2, 3, 4 }; // expected-error {{non-POD}}
-}
index 50ce6a49002ee5d9bb73d0d8db114dc74969f0ee..b74dcb4238ae97dc2eb8a9a904e3ccc0ba2d3414 100644 (file)
@@ -51,8 +51,3 @@ int k = 0b1001;
 #ifdef CXX1Y
 // expected-warning@-2 {{binary integer literals are incompatible with C++ standards before C++1y}}
 #endif
-
-void f(int n) { int a[n]; }
-#ifdef CXX1Y
-// expected-warning@-2 {{arrays of runtime bound are incompatible with C++ standards before C++1y}}
-#endif