Skip to content

Use declval instead of &O::get in cm::static_reference_cast

Sumit Bhardwaj requested to merge bhardwajs/cmake:sumitb/vs16 into master

Building CMake failed on a recent version of Visual Studio. I asked around and learned that this is because of a compiler bug exposed through the change in STL invoke machinery. I was also told that forming &O::get isn't strictly correct for a Standard Library type as STL implementation is allowed to template/overload member functions in ways that interfere with taking their address and therefore, it would be better to attempt to form the function call as in decltype(std::declval<O>().get()).

This MR changes the implementations of cm::static_reference_t and cm_dynamic_reference_t to use decltype(std::declval<O>.get()).

Topic-rename: cmext-vs16-declval

Edited by Brad King

Merge request reports