Skip to content

tribool doesn't play well with auto #19

@xiao-feng

Description

@xiao-feng

This prints "Not true.":

  tribool b = indeterminate;
  if(b) {
      cout << boolalpha << b << endl;
  }
  else {
      cout << "Not true." << endl;
  }

This prints "indeterminate":

  auto b = indeterminate;
  if(b) {
      cout << boolalpha << b << endl;
  }
  else {
      cout << "Not true." << endl;
  }

Is it a bug? Or is it expected behavior? What's the rationale?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions