| 1 |
// PR c++/101239 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
|
| 4 |
template<class T, int N> auto f(T* p) -> decltype(p[N]); |
| 5 |
template<class T, int N> auto f(T* p) -> decltype(p[-N]); |
| 6 |
template<class T, int N> auto f(T* p) -> decltype(N[p]); |
| 7 |
template<class T, int N> void f(T* p); |
| 8 |
|
| 9 |
template<class T> auto g(T* p, int n) -> decltype(p[n]); |
| 10 |
template<class T> auto g(T* p, int n) -> decltype(p[-n]); |
| 11 |
template<class T> auto g(T* p, int n) -> decltype(n[p]); |
| 12 |
template<class T> void g(T* p, int n); |
| 13 |
|
| 14 |
struct Incomplete; |
| 15 |
|
| 16 |
int main() { |
| 17 |
f<Incomplete, 0>(nullptr); |
| 18 |
f<Incomplete, 1>(nullptr); |
| 19 |
f<Incomplete, -1>(nullptr); |
| 20 |
f<Incomplete, 7>(nullptr); |
| 21 |
f<Incomplete, -7>(nullptr); |
| 22 |
|
| 23 |
g<Incomplete>(nullptr, 0); |
| 24 |
} |