pty_test: use a lambda rather than casting function pointers.

Change-Id: I51ad2134b3f5648c305f88d1b912a5eb69c802a2
diff --git a/tests/pty_test.cpp b/tests/pty_test.cpp
index 6e3d2c7..a5e5a57 100644
--- a/tests/pty_test.cpp
+++ b/tests/pty_test.cpp
@@ -103,8 +103,6 @@
   arg->finished = true;
 }
 
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wcast-function-type-mismatch"
 TEST(pty, bug_28979140) {
   // This test is to test a kernel bug, which uses a lock free ring-buffer to
   // pass data through a raw pty, but missing necessary memory barriers.
@@ -141,9 +139,10 @@
   arg.fd = tty;
   arg.data_count = TEST_DATA_COUNT;
   arg.matched = true;
-  ASSERT_EQ(0, pthread_create(&thread, nullptr,
-                              reinterpret_cast<void*(*)(void*)>(PtyReader_28979140),
-                              &arg));
+  ASSERT_EQ(0, pthread_create(&thread, nullptr, [](void* arg)->void* {
+    PtyReader_28979140(static_cast<PtyReader_28979140_Arg*>(arg));
+    return nullptr;
+  }, &arg));
 
   CPU_ZERO(&cpus);
   CPU_SET(arg.main_cpu_id, &cpus);
@@ -166,4 +165,3 @@
   ASSERT_TRUE(arg.matched);
   close(pty);
 }
-#pragma clang diagnostic pop
\ No newline at end of file