// C2893.cpp // OK in VS2013, Error in VS2015 // compile with: /EHsc #include <thread> // template <typename T_app> struct instance { void load() {;} }; // template <typename T_app> struct scene { T_app *p_app; void thread_load() { std::thread(&instance<T_app>::load, std::ref(p_app->app_inst) ).detach(); } }; // struct app { instance<app> app_inst; scene<app> app_scene; }; // int main() { app my_app; my_app.app_scene.p_app = &my_app; // OK in VS2013, Error in VS2015 my_app.app_scene.thread_load(); return 0; } Hello, I just updated to VS2015, the code in VS2013 is OK, how to correct the mistake of thread_load()? I read Breaking Changes in Visual C++ 2015, It must be Non-type template parameters problem, but I can not find a right way. Thanks.
void load() {;}void load() {}The semicolon is a blank statement (and should be discarded by the compiler).std::thread([&]{ p_app->app_inst.load(); }).detach()