Debian Codegraph @

clang/test/Sema/attr-lifetimebound-no-crash.cpp

raw
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
9 auto operator[](const int index) const [[clang::lifetimebound]] -> decltype(data[index]) {
10 return data[index];
11 }
12 };
13
14 int main() {
15 Bar<int> b;
16 (void)b[2];
17 }