Last active
March 2, 2017 14:30
-
-
Save akinomyoga/a42db5483a08d1b58165cc242da250a5 to your computer and use it in GitHub Desktop.
msc17 (VIsual Studio 2012 cl.exe) の信じがたいバグ: std::remove_pointer<void (*)()>::type の結果が変化する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <type_traits> | |
struct C { | |
C() {} | |
template<typename F> explicit C(const F& f, typename std::remove_pointer<F>::type* = nullptr) {} | |
template<typename F> void operator=(const F&) {} | |
}; | |
void f() { return 0; } | |
template<typename> void check_type() { std::printf("%s\n", __FUNCSIG__); } | |
int main() { | |
check_type<std::remove_pointer<void (*)()>::type>(); // → void __cdecl check_type<void(void)>(void) | |
C g; | |
g = f; | |
check_type<std::remove_pointer<void (*)()>::type>(); // → void __cdecl check_type<void(__cdecl *)(void)>(void) | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment