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 | b9fb121a62de69686dc193d32cba680a1a645277 (patch) | |
tree | 5ae91995df8eb4264fd2fa71fe3ef48a8e95d160 /clang/test/CodeGenCXX/new-array-init.cpp | |
parent | 9dd6537b3acf98c942cdb020c6ea26d9af309eb3 (diff) | |
download | bcm5719-llvm-b9fb121a62de69686dc193d32cba680a1a645277.tar.gz bcm5719-llvm-b9fb121a62de69686dc193d32cba680a1a645277.zip |
[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).
llvm-svn: 360006
Diffstat (limited to 'clang/test/CodeGenCXX/new-array-init.cpp')
-rw-r--r-- | clang/test/CodeGenCXX/new-array-init.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/new-array-init.cpp b/clang/test/CodeGenCXX/new-array-init.cpp index 90cd600229b..b504d5e7800 100644 --- a/clang/test/CodeGenCXX/new-array-init.cpp +++ b/clang/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, +} |