Warning C4864: is `template` keyword required to call `operator()` of a generic lambda declared inside another lambda?
After updating to Visual Studio 2026 18.12 (MSVC 19.52.37029), this program #include <utility> int main() { auto l = [] { auto g = []<class T> {}; g.operator()<int>(); }; l(); } produces with /std:c++20 /W4 the warning warning C4864: expected 'template' keyword before dependent template name MSVC 19.51 and earlier, GCC and Clang compile it without any warnings. The type of g does not seem to depend on any template parameter, so I expected template to be optional here. And if #include <utility> is removed, all MSVC versions I tried (19.29, 19.44, 19.51, 19.52) even report an error: error C2760:
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.