为什么结构化绑定在GCC上失败?

Jay*_*esh 2 c++ gcc structure c++17

以下结构化绑定代码在clang上运行良好.现场演示

但是,它在GCC编译器上失败了.现场演示

#include <iostream>

struct st {
  bool b = true;
};

template <class T>
bool func() noexcept {
  auto [a] = T{};
  return a;
}

int main() {
  const bool b1 = func<st>();
}
Run Code Online (Sandbox Code Playgroud)

为什么结构化绑定在GCC上失败?

Som*_*ken 5

这是GCC中引入的GCC中已知的错误.您的代码符合标准.