-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix compile with clang-3.5 #2462
Conversation
{ | ||
segment_speeds_counters.emplace_back(); | ||
segment_speeds_counters[i].store(0); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this better than the for (auto &each :
loop before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang35's stdlib does not support the vector constructor that takes a size when the template argument is a moveable only type. This is a bug in its stdlib. To work around this we default construct the vector, then loop n
times adding a new counter and initializing it explicitly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@daniel-j-h is it really a bug in the standard library or clang-3.5 itself? I'm asking because the standard library was the same on the system this replicates on and g++ was not impacted, only clang.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have the error here, but I thought the constructor was calling the atomic' deleted copy assignment operator. The stdlib implementation of the vector does this. Could also be that clang35 just picks a wrong assignment operator?
did you run |
@freenerd - no, will run clang-format next. But first it looks like this is not compiling on compilers that are not clang-3.5:
|
b1bcb25
to
4ae8abe
Compare
@TheMarex sorry, this was not passing yet. Per #2459 (comment) I wonder if this code can be re-written to avoid this brittle use of atomics. |
Addresses #2459