auto foo = "You're using g++!";
auto compiler_detector = [foo](auto foo) { std::puts(foo); };
compiler_detector("You're using clang++!");
Run Code Online (Sandbox Code Playgroud)
clang ++ 3.6.0和更新的打印出"你正在使用clang ++!" 并警告捕获 foo未被使用.
g ++ 4.9.0和更新版本打印出"你正在使用g ++!" 并警告该参数 foo未被使用.
什么编译器更准确地遵循C++标准?