repo.or.cz
/
llvm-project.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git]
/
clang
/
test
/
Sema
/
attr-lifetimebound-no-crash.cpp
blob
e668a78790defd7e01bba335125952d594e322a2
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
}