C++17 optional tree, error: invalid use of incomplete type
问题 When I compile a binary tree containing optional types: #include <optional> class BinaryTree { public: BinaryTree(); int value; std::optional<BinaryTree> left,right; }; int main() { return 0; } via g++ -std=c++17 -Wfatal-errors main.cpp I face with this error In file included from /usr/include/c++/7/bits/move.h:54:0, from /usr/include/c++/7/bits/stl_pair.h:59, from /usr/include/c++/7/utility:70, from /usr/include/c++/7/optional:36, from main.cpp:1: /usr/include/c++/7/type_traits: In