Fucked C++ question: I have a struct B, defined by me. I had the code auto &b = ...

@mcc@mastodon.social

Fucked C++ question:

I have a struct B, defined by me. I had the code

auto &b = bees.emplace_back(); //vector
b.value = 3;

A change *ELSEWHERE IN THE CODE* caused this to suddenly start failing with

"auto cannot be inferred"
changed the line to
B &b = bees.emplace_back();
The error became ("bees" underlined):
"initial value of reference to non-const must be an lvalue" (??)

Replaced the whole thing with
B b;
b.value = e;
bees.push_back(b);

The compiler allows this.

C++17.

wha ??? ?? ?????