In a recent build of GCC 4.8, the following code is shown if in the header file:
auto L = [](){}; struct S { decltype(L) m; };
following warning:
test.hpp:3:8: warning: 'S' has a field 'S::m' whose type uses the anonymous namespace [enabled by default] struct S ^
Why does the compiler consider the lambda type to use an anonymous namespace? I made a global lambda, I did not use an anonymous namespace anywhere.
UPDATE Compilations give the same warning even if I put lambda in an explicit namespace, for example:
namespace N { auto L = [](){}; } struct S { decltype(N::L) m; };
UPDATE 2 : in fact, it seems that the class lambdas class also has the same problem:
class N { static constexpr auto L = [](){}; }; struct S { decltype(N::L) m; };
source share