New issue
Advanced search Search tips

Issue 667031 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Nov 2016
Cc:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug

Blocking:
issue 554299



Sign in to add a comment

Improve compile error for OnceCallback

Project Member Reported by dcheng@chromium.org, Nov 19 2016

Issue description

Currently, if you have something which forgets to std::move():
  OnceClosure closure = base::BindOnce(...);
  closure.Run();

The compile error looks something like this:
../../base/bind_unittest.cc:415:17: error: cannot initialize object parameter of type 'base::internal::RunMixin<base::Callback<int (int), base::internal::CopyMode::MoveOnly, base::internal::RepeatMode::Once> >' with an expression of type 'OnceCallback<int (int)>' (aka 'base::Callback<int (int), base::internal::CopyMode::MoveOnly, base::internal::RepeatMode::Once>')

It would be nice if we could make this more readable: there's an upstream bug with clang that the diagnostic simply isn't helpful (https://llvm.org/bugs/show_bug.cgi?id=31067), but even with that change, I think it's easy to misunderstand this error.
 

Comment 1 by dcheng@chromium.org, Nov 19 2016

Owner: dcheng@chromium.org
Status: Started (was: Available)
Project Member

Comment 2 by bugdroid1@chromium.org, Nov 22 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/77172b96f4e84e91ace073cfacfcd9a50a3d96d8

commit 77172b96f4e84e91ace073cfacfcd9a50a3d96d8
Author: dcheng <dcheng@chromium.org>
Date: Tue Nov 22 07:46:06 2016

Improve compile error when invoking OnceCallback::Run on a non-rvalue.

Some callback helper templates have also been simplified.

BUG= 667031 

Review-Url: https://codereview.chromium.org/2517793002
Cr-Commit-Position: refs/heads/master@{#433810}

[modify] https://crrev.com/77172b96f4e84e91ace073cfacfcd9a50a3d96d8/base/bind_unittest.nc
[modify] https://crrev.com/77172b96f4e84e91ace073cfacfcd9a50a3d96d8/base/callback.h

Comment 3 by dcheng@chromium.org, Nov 22 2016

Status: Fixed (was: Started)

Sign in to add a comment