summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp0x/nullptr16.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/cpp0x/nullptr16.C')
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/nullptr16.C25
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr16.C b/gcc/testsuite/g++.dg/cpp0x/nullptr16.C
new file mode 100644
index 000000000..0ec0b6a12
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/nullptr16.C
@@ -0,0 +1,25 @@
+// { dg-do compile }
+// { dg-options "-std=c++0x" }
+
+// 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));
+}