aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/defaulted4.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/g++.dg/cpp0x/defaulted4.C')
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/cpp0x/defaulted4.C25
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/defaulted4.C b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/defaulted4.C
new file mode 100644
index 0000000..ca07d76
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/defaulted4.C
@@ -0,0 +1,25 @@
+// PR c++/37208: SFINAE and deleted functions.
+
+// { dg-do compile { target c++11 } }
+template<int> struct A { };
+
+template<typename T>
+int& int_if_addable(A<sizeof((*(T*)0) + (*(T*)0))>*);
+
+template<typename T>
+float& int_if_addable(...);
+
+struct X { };
+
+struct Y { };
+Y operator+(Y, Y);
+
+struct Z { };
+Z operator+(Z, Z) = delete;
+
+void f()
+{
+ float& x = int_if_addable<X>(0);
+ int& y = int_if_addable<Y>(0);
+ float& z = int_if_addable<Z>(0);
+}