1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify -std=c++11 %s
2 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify -std=c++11 -Wno-return-stack-address -Wreturn-local-addr %s
11 void *&non_pointer() {
12 void *&r
= S
<T
>()[I
{}];
18 void *&r
= S
<T
>()[nullptr];
23 namespace LocalTemporary
{
28 T
value(const T
&t
= T()) const {
41 ptr
int1(const ptr
&p
= ptr()) {
45 ptr
int2(const ptr
&p
= nullptr) {
54 const int *int4(const int &x
= 5) {
58 const int *int5(const int &x
) {
63 const int &x
= 11; //expected-note{{binding reference variable 'x' here}}
64 return &x
; //expected-warning{{returning address of local temporary object}}
67 const int *int7(int x
) {
68 const int &x2
= x
; // expected-note{{binding reference variable 'x2' here}}
69 return &x2
; // expected-warning{{address of stack memory associated with parameter 'x' returned}}
72 const int *int8(const int &x
= 5) {
78 const int &x
= 5; // expected-note{{binding reference variable 'x' here}}
79 const int &x2
= x
; // expected-note{{binding reference variable 'x2' here}}
80 return &x2
; // expected-warning{{returning address of local temporary object}}