https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85936
Bug ID: 85936
Summary: GCC incorrectly implements
[expr.prim.lambda.capture]/10.2
Product: gcc
Version: 8.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: lebedev.ri at gmail dot com
Target Milestone: ---
https://godbolt.org/g/qX6k2H
# 0 "" 3
template <class a> void b(int, a);
template <class a, class c> void b(int, a &&e, c) {
b(0, [=] { e; });
}
void d() { b(0, d, 0); }
gcc complans:
: error: 'void b(int, a) [with a = b(int, a&&, c) [with a = void (&)(); c =
int]::<lambda()>]', declared using local type 'b(int, a&&, c) [with a = void
(&)(); c = int]::<lambda()>', is used but never defined [-fpermissive]
That is incorrect, the code is perfectly valid.