struct foo { struct bar { ~bar() {} // no error w/o this line }; bar *data = nullptr; // no error w/o this line foo() noexcept = default; // no error w/o this line };
Yes, I know, there is one more question with exactly the same name, but a slightly different problem (involving the noexcept operator and no nested type). Proposed Solution (replacing the foo constructor with
foo() noexcept {}
) changes the semantics, and here it is not needed: here we have a better answer (therefore, the question is not a duplicate).
: Apple LLVM version 9.0.0 (clang-900.0.37) , full error message:
test.cc:44:5: error: default member initializer for 'data' needed within definition of enclosing class 'foo' outside of member functions foo() noexcept = default; ^ test.cc:41:10: note: default member initializer declared here bar* data = nullptr; ^
c ++ language-lawyer c ++ 11 noexcept inner-classes
Walter
source share