[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Sema / attr-lifetimebound-no-crash.cpp
blobe668a78790defd7e01bba335125952d594e322a2
1 // RUN: %clang_cc1 %s -verify -fsyntax-only
3 // expected-no-diagnostics
5 template<typename T>
6 struct Bar {
7 int* data;
9 auto operator[](const int index) const [[clang::lifetimebound]] -> decltype(data[index]) {
10 return data[index];
14 int main() {
15 Bar<int> b;
16 (void)b[2];