Skip to content

std_lib_facilities.h error: cannot bind non-const lvalue reference of type 'bool&' to an rvalue of type 'bool' #15

Open
@ivanusick

Description

@ivanusick

When using the subscript operator [] on a vector<bool> i.e

vector<bool> a;

a.push_back(true);

cout << a[0];

results in:

error: cannot bind non-const lvalue reference of type 'bool&' to an rvalue of type 'bool'
87 | return std::vector::operator[](i);

Tested on gcc 11.2.0 and clang 13.0 for C++11

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions