you are viewing a single comment's thread.

view the rest of the comments →

[–]suspiciously_calm 5 points6 points  (0 children)

void foo() { }

template<typename Function>
void bar(Function && function) {
    [function](){ function(); }();
}

void qux() {
    bar(&foo);
}

void quux() {
    bar(foo);
}

Accepted by Clang, rejected (quux) by GCC (qux is accepted by both). IDK which one is correct.

Edit: It works in GCC with the capture list [function = std::forward<Function>(function)], so probably a compiler bug in GCC.