diff options
Diffstat (limited to 'gcc/testsuite/g++.dg/template/sfinae15.C')
-rw-r--r-- | gcc/testsuite/g++.dg/template/sfinae15.C | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/template/sfinae15.C b/gcc/testsuite/g++.dg/template/sfinae15.C new file mode 100644 index 000000000..27bce255d --- /dev/null +++ b/gcc/testsuite/g++.dg/template/sfinae15.C @@ -0,0 +1,23 @@ +// PR c++/40944 +// { dg-options -std=c++0x } +// { dg-do run } + +template<typename T> +struct make { static T&& it(); }; + +void (*pf)(int&) = 0; + +template< typename T > +int bar(T const& x, + decltype( pf(make<T const&>::it()) )* = 0 // SFINAE! + ) { + return 1; +} + +int bar(...) { + return 0; +} + +int main() { + return bar(42); +} |