xref: /llvm-project/clang/test/Sema/attr-lifetimebound-no-crash.cpp (revision d9d1ae6400a7f8a12068bdd37ecda62f07e52bce)
1 // RUN: %clang_cc1 %s -verify -fsyntax-only
2 
3 // expected-no-diagnostics
4 
5 template<typename T>
6 struct Bar {
7     int* data;
8 
operator []Bar9     auto operator[](const int index) const [[clang::lifetimebound]] -> decltype(data[index]) {
10         return data[index];
11     }
12 };
13 
main()14 int main() {
15     Bar<int> b;
16     (void)b[2];
17 }
18