C++ [[可能未使用]]与结构化绑定?
我如何防止这里的警告<代码>[[maybe_unused]]在这种情况下似乎不起作用?如评论所示,C++ [[可能未使用]]与结构化绑定?,c++,c++17,C++,C++17,我如何防止这里的警告[[maybe_unused]]在这种情况下似乎不起作用?如评论所示,-Wunused变量仅出现在gcc7中 [[maybe_unused]]不需要更新的gcc什么编译器(和版本)?Clang 5和gcc 9都不会产生这种诊断。只需升级编译器: : warning: unused variable ‘_y’ [-Wunused-variable] [[maybe_unused]] const auto [x, _y] = f();
-Wunused变量仅出现在gcc7中
[[maybe_unused]]
不需要更新的gcc什么编译器(和版本)?Clang 5和gcc 9都不会产生这种诊断。只需升级编译器:
: warning: unused variable ‘_y’ [-Wunused-variable]
[[maybe_unused]] const auto [x, _y] = f();