| 1 |
// PR c++/91844 - Implement CWG 2352, Similar types and reference binding. |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
|
| 4 |
// These should bind directly to ptr, so no -Wreturn-local-addr warnings. |
| 5 |
int *ptr; |
| 6 |
|
| 7 |
const int *const & |
| 8 |
fn1 () |
| 9 |
{ |
| 10 |
return ptr; |
| 11 |
} |
| 12 |
|
| 13 |
int **const ptr2 = nullptr; |
| 14 |
const int *const *const & |
| 15 |
fn2 () |
| 16 |
{ |
| 17 |
return ptr2; |
| 18 |
} |
| 19 |
|
| 20 |
int (*ptr3)[10]; |
| 21 |
using T = const int (*const)[10]; |
| 22 |
|
| 23 |
T& |
| 24 |
fn3 () |
| 25 |
{ |
| 26 |
return ptr3; |
| 27 |
} |
| 28 |
|
| 29 |
int (**ptr4)[5] = nullptr; |
| 30 |
using T2 = const int (*const *const)[5]; |
| 31 |
|
| 32 |
T2& |
| 33 |
fn4 () |
| 34 |
{ |
| 35 |
return ptr4; |
| 36 |
} |
| 37 |
|
| 38 |
const int **ptr5 = nullptr; |
| 39 |
|
| 40 |
const int *const *const & |
| 41 |
fn5 () |
| 42 |
{ |
| 43 |
return ptr5; |
| 44 |
} |