3 ms·
I'm also with the VC team here, a const but not static instance field? Their stance seems correct that that should be initialized - in a constructor.
by revelation 10y ago
I'm also with the VC team here, a const but not static instance field? Their stance seems correct that that should be initialized - in a constructor.
- wfunction 10y agoNot sure why you replied to my comment (seems like an unrelated comment?), but anyway, this should work too; you shouldn't need a constructor: struct { const int x; } y = { 1 };
- brucedawson 10y agoVC++ 2010 used to think that too and would generate warning C4610 for const non-static members. However that warning was wrong, and was changed to not fire in that case. See this link: https://connect.microsoft.com/VisualStudio/feedback/details/866320/incorrect-warning-c4610 https://connect.microsoft.com/VisualStudio/feedback/details/...