r312109 - Add test case that was broken by r311970.

Martin Bohme via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 30 03:44:51 PDT 2017


Author: mboehme
Date: Wed Aug 30 03:44:51 2017
New Revision: 312109

URL: http://llvm.org/viewvc/llvm-project?rev=312109&view=rev
Log:
Add test case that was broken by r311970.

See also discussion here:
https://reviews.llvm.org/rL301963

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

Modified:
    cfe/trunk/test/SemaCXX/constant-expression-cxx11.cpp

Modified: cfe/trunk/test/SemaCXX/constant-expression-cxx11.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/constant-expression-cxx11.cpp?rev=312109&r1=312108&r2=312109&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/constant-expression-cxx11.cpp (original)
+++ cfe/trunk/test/SemaCXX/constant-expression-cxx11.cpp Wed Aug 30 03:44:51 2017
@@ -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]; };




More information about the cfe-commits mailing list