Update: this does not involve threads (see new minimal version below). Also, adding -O2 to the above version (with threading) gives no output, but creates a SEGV with the version below. Finally, the bug occurs at compile-time, not link time, since the object file (".o") created from this also errors when run on CentOS.
#include <functional> #include <stdio.h> struct run { const std::function<void()> &fn; run(const std::function<void()> &fn_) : fn(fn_) {} void operator()() { fn(); } }; int main() { auto fn1 = [](){ printf("fn1\n"); }; auto r1 = run(fn1); auto fn2 = [](){ printf("fn2\n"); }; auto r2 = run(fn2); r1(); r2(); } -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1876958 Title: Ubuntu-specific pthread issue To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/gcc-defaults/+bug/1876958/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs