Skip to content

Commit 09d8ca2

Browse files
committed
[clang] Cover more cases of a template function that might return void.
1 parent f3b6b56 commit 09d8ca2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

clang/test/SemaCXX/attr-lifetimebound.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ namespace usage_ok {
3434

3535
template <class T, class R = void> R dependent_void(const T& t [[clang::lifetimebound]]);
3636
void dependent_void_instantiation() {
37-
dependent_void<int>(1);
37+
dependent_void<int>(1); // OK: Returns void.
38+
int x = dependent_void<int, int>(1); // expected-warning {{temporary whose address is used as value of local variable 'x' will be destroyed at the end of the full-expression}}
39+
dependent_void<int, int>(1); // OK: Returns an unused value.
3840
}
3941

4042
struct A {

0 commit comments

Comments
 (0)