aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/sfinae43.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/g++.dg/cpp0x/sfinae43.C')
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/cpp0x/sfinae43.C31
1 files changed, 31 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/sfinae43.C b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/sfinae43.C
new file mode 100644
index 0000000..14c31f6
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/sfinae43.C
@@ -0,0 +1,31 @@
+// PR c++/56208
+// { dg-do compile { target c++11 } }
+
+struct ostream {
+ ostream& operator<<(int);
+};
+
+struct sfinae_base {
+
+ typedef char one;
+ typedef char (&two)[2];
+
+ template<class T>
+ static T make();
+
+ template<unsigned> struct ok { typedef int type; };
+
+ template<class U, class T>
+ static one test(decltype((make<U>() << make<T>()), 0));
+
+ template<class, class>
+ static two test(...);
+};
+
+template<class T>
+struct is_printable : private sfinae_base
+{
+ enum { value = sizeof(test<ostream&, T>(0)) == sizeof(one) };
+};
+
+typedef int ok[is_printable<int>::value ? 1 : -1];