| 1 |
// PR c++/93259 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
|
| 4 |
template <class T, class U> struct is_same; |
| 5 |
template <class T> struct is_same<T,T> { }; |
| 6 |
|
| 7 |
using Array = int[]; |
| 8 |
|
| 9 |
template <typename ...Ts> |
| 10 |
void bar1(Ts ...) |
| 11 |
{ |
| 12 |
auto && array = Array{ 1, 2, 3 }; |
| 13 |
|
| 14 |
is_same<int (&&)[3], decltype(array)>{}; // this fails, deduces array as int (&&) [] |
| 15 |
} |
| 16 |
|
| 17 |
template <typename T> |
| 18 |
void bar2() |
| 19 |
{ |
| 20 |
auto && array = Array{ 1, 2, 3 }; |
| 21 |
|
| 22 |
is_same<int (&&)[3], decltype(array)>{}; // this fails, deduces array as int (&&) [] |
| 23 |
} |
| 24 |
|
| 25 |
void bar3() |
| 26 |
{ |
| 27 |
auto && array = Array{ 1, 2, 3 }; |
| 28 |
|
| 29 |
is_same<int (&&)[3], decltype(array)>{}; // OK |
| 30 |
} |
| 31 |
|
| 32 |
int main() |
| 33 |
{ |
| 34 |
bar1<int>(1, 2, 3); |
| 35 |
bar2<int>(); |
| 36 |
bar3(); |
| 37 |
} |