diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2019-05-06 03:47:15 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2019-05-06 03:47:15 +0000 |
commit | 5b0a110410710c5e5b3a197edced3676c92b6e89 (patch) | |
tree | 8a3994ce841efa3aa2dfb291957cdd316053d3a1 /test/CodeGenCXX/new-array-init.cpp | |
parent | f14f7e2753fb69cec95009f4f3b2e3eab14e4f10 (diff) |
[c++20] Implement P1009R2: allow omitting the array bound in an array
new expression.
This was voted into C++20 as a defect report resolution, so we
retroactively apply it to all prior language modes (though it can never
actually be used before C++11 mode).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360006 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/new-array-init.cpp')
-rw-r--r-- | test/CodeGenCXX/new-array-init.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/CodeGenCXX/new-array-init.cpp b/test/CodeGenCXX/new-array-init.cpp index 90cd600229..b504d5e780 100644 --- a/test/CodeGenCXX/new-array-init.cpp +++ b/test/CodeGenCXX/new-array-init.cpp @@ -123,3 +123,25 @@ void constexpr_test() { // SIO: call i8* @_Zna{{.}}(i32 4) new int[0+1]{0}; } + +// CHECK-LABEL: define void @_Z13unknown_boundv +void unknown_bound() { + struct Aggr { int x, y, z; }; + new Aggr[]{1, 2, 3, 4}; + // CHECK: call {{.*}}_Znaj(i32 24) + // CHECK: store i32 1 + // CHECK: store i32 2 + // CHECK: store i32 3 + // CHECK: store i32 4 + // CHECK: store i32 0 + // CHECK: store i32 0 + // CHECK-NOT: store + // CHECK: } +} + +// CHECK-LABEL: define void @_Z20unknown_bound_stringv +void unknown_bound_string() { + new char[]{"hello"}; + // CHECK: call {{.*}}_Znaj(i32 6) + // CHECK: memcpy{{.*}} i32 6, +} |