mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-24 22:08:57 -04:00

Previously we'd try to perform checks on the captures from the middle of parsing the lambda's body, at the point where we detected that a variable needed to be captured. This was wrong in a number of subtle ways. In PR23334, we couldn't correctly handle the list of potential odr-uses resulting from the capture, and our attempt to recover from that resulted in a use-after-free. We now defer building the initialization expression until we leave the lambda body and return to the enclosing context, where the initialization does the right thing. This patch only covers lambda-expressions, but we should apply the same change to blocks and captured statements too. llvm-svn: 235921
11 lines
358 B
C++
11 lines
358 B
C++
// RUN: %clang_cc1 -std=c++11 -verify %s -Wno-unused
|
|
|
|
// This must be at the start of the file (the failure depends on a SmallPtrSet
|
|
// not having been reallocated yet).
|
|
void fn1() {
|
|
// expected-no-diagnostics
|
|
constexpr int kIsolationClass = 0;
|
|
const int kBytesPerConnection = 0;
|
|
[=] { kIsolationClass, kBytesPerConnection, kBytesPerConnection; };
|
|
}
|