c ++ 17:内部类默认成员初始化程序在堆栈内联变量中被忽略

Compiling it using clang -std=c++17, and the error msg is default member initializer for '_x' needed within definition of enclosing class 'A' outside of member functions. I tried it with gcc, and got the same error msg.

对于我来说,为什么不允许使用它不是很明显,而且一旦将内部结构移到封闭类之外(将B从A移出),它就可以很好地编译了。

#include <iostream>

class A {
struct B {
  size_t _x = 0;
};
  private:
    static inline B b = {};
};

int main(void) {
  return 0;
}