Skip to content

Instantly share code, notes, and snippets.

@marzer
Last active June 15, 2022 15:19
Show Gist options
  • Select an option

  • Save marzer/b0f1648d983aeb08a635ae922691f92e to your computer and use it in GitHub Desktop.

Select an option

Save marzer/b0f1648d983aeb08a635ae922691f92e to your computer and use it in GitHub Desktop.
// repro of two lambda-related bugs in MSVC 1933.31517 (VS 2022 17.3.0 Pre2)
//
// required flags: /std:c++17 or /std:c++20 or /std:c++latest (all fail)
//
// previously worked in whatever the MSVC version was in VS 2022 17.3.0 Pre1
#include <type_traits>
#define REPRO_INTERNAL_COMPILER_ERROR 1
#define REPRO_INCORRECT_TRAIT_VALUE 1
int main()
{
static constexpr auto lambda = []() {};
#if REPRO_INTERNAL_COMPILER_ERROR
// this version of the assertion triggers an ICE
static_assert(std::is_function<std::remove_pointer_t<decltype(+lambda)>>::value);
#endif
#if REPRO_INCORRECT_TRAIT_VALUE
// this version of the assertion does not cause an ICE but yields an incorrect value for std::is_function
static_assert(std::is_function<std::remove_pointer<decltype(+lambda)>::type>::value);
#endif
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment