diff options
Diffstat (limited to 'gcc-4.9/gcc/testsuite/g++.dg/cpp0x/sfinae10.C')
-rw-r--r-- | gcc-4.9/gcc/testsuite/g++.dg/cpp0x/sfinae10.C | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/sfinae10.C b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/sfinae10.C new file mode 100644 index 0000000..25ef77d --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/sfinae10.C @@ -0,0 +1,18 @@ +// PR c++/48452 +// { dg-do compile { target c++11 } } +namespace std { + template <class T> T&& declval(); +} + +template<class T, class... Args> +decltype(T(std::declval<Args>()...), char()) f(int); + +template<class, class...> +char (&f(...))[2]; + +struct A { virtual ~A() = 0; }; +struct B {}; + +static_assert(sizeof(f<A, int, int>(0)) != 1, "Error"); // a +static_assert(sizeof(f<B, void, int>(0)) != 1, "Error"); // b +static_assert(sizeof(f<void, int, int>(0)) != 1, "Error"); // c |