Skip to content
Snippets Groups Projects
Commit 916ec36d authored by Patrick Palka's avatar Patrick Palka
Browse files

c++: Add testcase for SFINAE w/ p[N] and incomplete type [PR101239]

The r12-6123 fix for SFINAE with p+N and incomplete type also fixed
the analogous issue with p[N].

	PR c++/101239

gcc/testsuite/ChangeLog:

	* g++.dg/template/sfinae32a.C: New test.
parent 88cdcb5c
No related branches found
No related tags found
No related merge requests found
// PR c++/101239
// { dg-do compile { target c++11 } }
template<class T, int N> auto f(T* p) -> decltype(p[N]);
template<class T, int N> auto f(T* p) -> decltype(p[-N]);
template<class T, int N> auto f(T* p) -> decltype(N[p]);
template<class T, int N> void f(T* p);
template<class T> auto g(T* p, int n) -> decltype(p[n]);
template<class T> auto g(T* p, int n) -> decltype(p[-n]);
template<class T> auto g(T* p, int n) -> decltype(n[p]);
template<class T> void g(T* p, int n);
struct Incomplete;
int main() {
f<Incomplete, 0>(nullptr);
f<Incomplete, 1>(nullptr);
f<Incomplete, -1>(nullptr);
f<Incomplete, 7>(nullptr);
f<Incomplete, -7>(nullptr);
g<Incomplete>(nullptr, 0);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment