Bug #2179
closed
best-route v2 test case: build error on OSX 10.9 with clang-500.2.79
Added by Junxiao Shi about 10 years ago.
Updated about 10 years ago.
Description
../tests/daemon/fw/best-route-strategy2.cpp:98:60: error: variable 'periodicalRetxFrom4' is uninitialized when used within its own initialization [-Werror,-Wuninitialized]
retxFrom4Evt = scheduler::schedule(RETRANSMISSION_10P, periodicalRetxFrom4);
^~~~~~~~~~~~~~~~~~~
1 error generated.
This appears only on our Mac Mini, but I'm afraid it would start appearing elsewhere.
This error doesn't make sense for me. There is no "own initialization", unless there is some compiler optimization that creates such thing.
What if you try to replace capture with &, periodicalRetxFrom4
(to copy periodicalRetxFrom4, instead of taking reference). Would this make things better or worse?
The edit proposed in note-2 yields:
../tests/daemon/fw/best-route-strategy2.cpp:85:46: error: variable 'periodicalRetxFrom4' is uninitialized when used within its own initialization [-Werror,-Wuninitialized]
function<void()> periodicalRetxFrom4 = [&, periodicalRetxFrom4] {
~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~
1 error generated.
I think scheduler
should provide a periodical scheduling feature. It's useful for this test case and also #2056.
In fact, I think the error makes sense. Using capture-by-value as suggested is completely wrong here, you have to capture periodicalRetxFrom4
by reference, but with a small variation. Try this:
function<void()> periodicalRetxFrom4;
periodicalRetxFrom4 = [&] {
...
}
- Status changed from New to In Progress
- Status changed from In Progress to Code review
- % Done changed from 0 to 100
- Status changed from Code review to Closed
Also available in: Atom
PDF