gcc/testsuite/g++.dg/cpp0x/pr63506-2.C
raw| 1 | // { dg-do compile { target c++11 } } |
| 2 | |
| 3 | struct proxy {}; |
| 4 | |
| 5 | struct iterator |
| 6 | { |
| 7 | proxy operator*() { return proxy(); } |
| 8 | |
| 9 | proxy operator[](int i) { return proxy(); } |
| 10 | }; |
| 11 | |
| 12 | //#define DEACTIVATE |
| 13 | |
| 14 | #ifndef DEACTIVATE |
| 15 | template<typename T = int> |
| 16 | #endif |
| 17 | void foo(iterator it) |
| 18 | { |
| 19 | auto&& x = *it; |
| 20 | auto&& y = it[1]; |
| 21 | } |
| 22 | |
| 23 | int main() |
| 24 | { |
| 25 | iterator it; |
| 26 | foo(it); |
| 27 | } |