diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2018-10-19 19:01:34 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2018-10-19 19:01:34 +0000 |
| commit | b3d203ff7f308cc5675f095654d0cda905bf95bf (patch) | |
| tree | 827f58b9968e6a725ea2d02434ceea1869981c9b /clang/test/CodeGenCXX/cxx1y-init-captures.cpp | |
| parent | 36f62c066a8cd97a0b3459eec11d929ec875c941 (diff) | |
| download | bcm5719-llvm-b3d203ff7f308cc5675f095654d0cda905bf95bf.tar.gz bcm5719-llvm-b3d203ff7f308cc5675f095654d0cda905bf95bf.zip | |
PR24164, PR39336: init-captures are not distinct full-expressions.
Rather, they are subexpressions of the enclosing lambda-expression, and
any temporaries in them are destroyed at the end of that
full-expression, or when the corresponding lambda-expression is
destroyed if they are lifetime-extended.
llvm-svn: 344801
Diffstat (limited to 'clang/test/CodeGenCXX/cxx1y-init-captures.cpp')
| -rw-r--r-- | clang/test/CodeGenCXX/cxx1y-init-captures.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/cxx1y-init-captures.cpp b/clang/test/CodeGenCXX/cxx1y-init-captures.cpp index dcfe4d47292..c76180c5bf4 100644 --- a/clang/test/CodeGenCXX/cxx1y-init-captures.cpp +++ b/clang/test/CodeGenCXX/cxx1y-init-captures.cpp @@ -38,6 +38,19 @@ void g() { // CHECK: add nsw i32 +// CHECK-LABEL: define void @_Z18init_capture_dtorsv +void init_capture_dtors() { + // Ensure that init-captures are not treated as separate full-expressions. + struct HasDtor { ~HasDtor() {} }; + void some_function_call(); + void other_function_call(); + // CHECK: call {{.*}}some_function_call + // CHECK: call {{.*}}HasDtorD + ([x = (HasDtor(), 0)]{}, some_function_call()); + // CHECK: call {{.*}}other_function_call + other_function_call(); +} + int h(int a) { // CHECK-LABEL: define i32 @_Z1hi( // CHECK: %[[A_ADDR:.*]] = alloca i32, |

