]> granicus.if.org Git - clang/commitdiff
Add test case that was broken by r311970.
authorMartin Bohme <mboehme@google.com>
Wed, 30 Aug 2017 10:44:51 +0000 (10:44 +0000)
committerMartin Bohme <mboehme@google.com>
Wed, 30 Aug 2017 10:44:51 +0000 (10:44 +0000)
See also discussion here:
https://reviews.llvm.org/rL301963

As far as I can tell, this discussion was never resolved.

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

test/SemaCXX/constant-expression-cxx11.cpp

index 3fda2d0a7fd0ede6c201b27dd1ca750579200482..b1575077cdf16eb93e114c50de24f2da375af240 100644 (file)
@@ -604,6 +604,22 @@ static_assert(NATDCArray{}[1][1].n == 0, "");
 
 }
 
+// Tests for indexes into arrays of unknown bounds.
+namespace ArrayOfUnknownBound {
+  // This is a corner case of the language where it's not clear whether this
+  // should be an error: When we see the initializer for Z::a, the bounds of
+  // Z::b aren't known yet, but they will be known by the end of the translation
+  // unit, so the compiler can in theory check the indexing into Z::b.
+  // For the time being, as long as this is unclear, we want to make sure that
+  // this compiles.
+  struct Z {
+    static const void *const a[];
+    static const void *const b[];
+  };
+  constexpr const void *Z::a[] = {&b[0], &b[1]};
+  constexpr const void *Z::b[] = {&a[0], &a[1]};
+}
+
 namespace DependentValues {
 
 struct I { int n; typedef I V[10]; };