1 // RUN: %clang_cc1 -verify -std=c++20 %s -fsyntax-only
4 template <class T
> struct remove_reference
{ typedef T type
; };
5 template <class T
> struct remove_reference
<T
&> { typedef T type
; };
6 template <class T
> struct remove_reference
<T
&&> { typedef T type
; };
8 template <class T
> typename remove_reference
<T
>::type
&&move(T
&&t
);
20 A a1
{1, f()}; // OK, lifetime is extended for direct-list-initialization
21 // well-formed, but dangling reference
22 A
a2(1, f()); // expected-warning {{temporary whose address is used as value}}
23 // well-formed, but dangling reference
24 A
a4(1.0, 1); // expected-warning {{temporary whose address is used as value}}
25 A
a5(1.0, std::move(n
)); // OK
33 return B(1); // expected-warning {{returning address}}
34 return B(local
); // expected-warning {{address of stack memory}}
38 void test2(int local
) {
39 // No diagnostic on the following cases where both the aggregate object and
40 // temporary end at the end of the full expression.
45 // Test nested struct.
55 1 // expected-warning {{temporary whose address is used as value}}
58 1 // expected-warning {{temporary whose address is used as value}}