]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/testsuite/gdc.test/runnable/test20734.d
Merge remote-tracking branch 'origin/master' into devel/c++-contracts
[thirdparty/gcc.git] / gcc / testsuite / gdc.test / runnable / test20734.d
index b3c5916ada500b5d7a10c371d98f13c360e16bd1..bd012bba19e382aa6689c5ff8554b0b712d7e5f6 100644 (file)
@@ -17,6 +17,14 @@ extern(C) int main() nothrow @nogc @safe
     takeScopeSlice([ S(1), S(2) ]); // @nogc => no GC allocation
     (() @trusted { assert(numDtor == 2); })(); // stack-allocated array literal properly destructed
     assert23100([]);
+
+    // https://issues.dlang.org/show_bug.cgi?id=22306
+    // scope array variable should be stack allocated
+    scope int[] sa = [10, 20];
+    assert(sa[0] == 10);
+    assert(sa[1] == 20);
+    assert(sa.length == 2);
+
     return 0;
 }