New issue
Advanced search Search tips

Issue 737011 link

Starred by 1 user

Issue metadata

Status: Duplicate
Merged: issue 737010
Owner:
Closed: Jun 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

base::Bind should ban raw pointers to ref-counted types

Project Member Reported by tzik@chromium.org, Jun 27 2017

Issue description

base::Bind is intended to reject raw pointers to ref-counted types unless it's a this pointer.
E.g.:
  struct Foo : base::RefCounted<Foo> {};
  void Bar(Foo*) {}
  void Baz(scoped_refptr<Foo>) {}

  Foo* p = nullptr;
  base::Bind(&Bar, p);  // Should be compile error.
  base::Bind(&Baz, p);  // Should be compile error.

base::Bind implementation has a static_assert to ban this pattern. However, the check has been regressed from some point and those base::Bind usages compile.

Context: https://groups.google.com/a/chromium.org/d/msg/chromium-dev/qH5swrLHPmg/6E1FE5okAgAJ
 

Comment 1 by tzik@chromium.org, Jun 27 2017

Mergedinto: 737010
Status: Duplicate (was: Assigned)

Sign in to add a comment