aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/nullptr16.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/g++.dg/cpp0x/nullptr16.C')
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/cpp0x/nullptr16.C24
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/nullptr16.C b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/nullptr16.C
new file mode 100644
index 0000000..62029b3
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/nullptr16.C
@@ -0,0 +1,24 @@
+// { dg-do compile { target c++11 } }
+
+// Test template deduction
+
+typedef decltype(nullptr) nullptr_t;
+
+template <typename T, typename U> struct tType_equal;
+template <typename T> struct tType_equal<T, T> { typedef void type; };
+
+template <typename T, typename U>
+inline typename tType_equal<T, U>::type
+type_equal(U) { }
+
+template<typename T> T h( T t );
+
+void test_h()
+{
+ type_equal<int>(h(0));
+ type_equal<nullptr_t>(h(nullptr));
+ type_equal<float*>(h((float*)nullptr));
+ nullptr_t mynull = 0;
+ type_equal<nullptr_t>(h(mynull));
+ type_equal<float*>(h((float*)mynull));
+}