diff options
author | ajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-10 03:14:35 +0000 |
---|---|---|
committer | ajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-10 03:14:35 +0000 |
commit | 481915a77d8a2d0a968f1963271a13618bea9908 (patch) | |
tree | 40b0ae8b2616cff35cccfa87b3ef21999aad7346 /base/bind_unittest.nc | |
parent | 81814bce7954f38311b39c488ba076a297458534 (diff) | |
download | chromium_src-481915a77d8a2d0a968f1963271a13618bea9908.zip chromium_src-481915a77d8a2d0a968f1963271a13618bea9908.tar.gz chromium_src-481915a77d8a2d0a968f1963271a13618bea9908.tar.bz2 |
Make Callback.Equals() only work when comparing against the same type.
Previously, we were using the base class's comparator to check equality, which allows us to make comparisons across callbacks of different types. This disallows such a thing.
BUG=none
TEST=New no-compile test.
Review URL: http://codereview.chromium.org/7780016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100565 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/bind_unittest.nc')
-rw-r--r-- | base/bind_unittest.nc | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/base/bind_unittest.nc b/base/bind_unittest.nc index 2d07cbb..eba8747 100644 --- a/base/bind_unittest.nc +++ b/base/bind_unittest.nc @@ -80,27 +80,6 @@ void WontCompile() { method_to_const_cb.Run(); } -#elif defined(NCTEST_CONSTRUCTION_FROM_SUBTYPE) // [r"conversion from 'base::Callback<int\(\)>' to non-scalar type 'base::Callback<void\(\)>'"] - -// Construction of Callback<A> from Callback<B> if A is supertype of B. -// -// While this is technically safe, most people aren't used to it when coding -// C++ so if this is happening, it is almost certainly an error. -void WontCompile() { - Callback<int(void)> cb_a = Bind(&PolymorphicIdentity<int>, 1); - Callback<void(void)> cb_b = cb_a; -} - -#elif defined(NCTEST_ASSIGNMENT_FROM_SUBTYPE) // [r"no match for 'operator=' in 'cb_a = cb_b'"] - -// Assignment of Callback<A> from Callback<B> if A is supertype of B. -// See explanation for NCTEST_CONSTRUCTION_FROM_SUBTYPE -void WontCompile() { - Callback<int(void)> cb_a = Bind(&PolymorphicIdentity<int>, 1); - Callback<void(void)> cb_b; - cb_a = cb_b; -} - #elif defined(NCTEST_METHOD_BIND_NEEDS_REFCOUNTED_OBJECT) // [r"has no member named 'AddRef'"] // Method bound to non-refcounted object. |