New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 658116 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner:
Not currently working on Chromium
Closed: Oct 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 3
Type: Bug



Sign in to add a comment

base::Optional::operator bool doesn't convert to 'bool'

Project Member Reported by scheib@chromium.org, Oct 21 2016

Issue description

I expect this code to compile:
  Optional<TestObject> a;
  bool b = a;

because base::Optional has 
  constexpr explicit operator bool()

However, it produces an error
  // error: no viable conversion from
  // 'Optional<base::(anonymous namespace)::TestObject>' to 'bool'

See https://codereview.chromium.org/2437313002

I don't know why this doesn't work, yet.
 

Comment 1 by scheib@chromium.org, Oct 21 2016

Status: WontFix (was: Started)
Never mind... I'm thinking that I didn't understand http://en.cppreference.com/w/cpp/language/explicit sufficiently, missing that it blocked http://en.cppreference.com/w/cpp/language/copy_initialization and so this behavior is expected.

Comment 2 by scheib@chromium.org, Oct 21 2016

:P clang error request filed: https://llvm.org/bugs/show_bug.cgi?id=30754

Sign in to add a comment