From 6a341fbb4fa4651ea5d60ce8aa57e5fabe3da375 Mon Sep 17 00:00:00 2001 From: "ajwong@chromium.org" Date: Sun, 26 Jun 2011 16:22:50 +0000 Subject: Add COMPILE_ASSERT to ensure the result of Bind matches the Callback's type. Required because we abstract the storage of the funciton pointer out using a reinterpret_cast to reduce template bloat. This effectively readds the failure that would have happened had we stored the function pointer directly in the template class. BUG=86008 TEST=new unittests. Review URL: http://codereview.chromium.org/7241015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90525 0039d316-1c4b-4281-b951-d872f2087c98 --- base/bind_unittest.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'base/bind_unittest.cc') diff --git a/base/bind_unittest.cc b/base/bind_unittest.cc index d57f3d0..333512a 100644 --- a/base/bind_unittest.cc +++ b/base/bind_unittest.cc @@ -677,6 +677,8 @@ TEST_F(BindTest, NoCompile) { // Callback weak_ptr_with_non_void_return_type = // Bind(&NoRef::IntMethod0, weak_factory.GetWeakPtr()); + // - Bind result cannot be assigned to Callbacks with a mismatching type. + // Closure callback_mismatches_bind_type = Bind(&VoidPolymorphic1); } #if defined(OS_WIN) -- cgit v1.1