gcc/testsuite/g++.dg/cpp0x/decltype66.C
raw| 1 | // PR c++/71350 |
| 2 | // { dg-do compile { target c++11 } } |
| 3 | |
| 4 | template<typename T, unsigned int N> |
| 5 | struct Array |
| 6 | { |
| 7 | T data[N]; |
| 8 | }; |
| 9 | |
| 10 | template<typename T> |
| 11 | struct Foo |
| 12 | { |
| 13 | int operator[](const Array<int, 2>& i) const { return 0; } |
| 14 | auto bar() -> decltype((*this)[{1,2}] * 0) { |
| 15 | return *this; // { dg-error "cannot convert" } |
| 16 | } |
| 17 | }; |
| 18 | |
| 19 | template struct Foo<int>; |