Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compilation error when targeting C++23 #926

Merged
merged 1 commit into from
Feb 9, 2025

Conversation

vincent-hui
Copy link
Contributor

@vincent-hui vincent-hui commented Feb 4, 2025

Compilation fails if cxx_std_17 is changed to cxx_std_23 with gcc 15 because expected_lite namespace is not declared. Commit fixes this.

/home/vincent/BehaviorTree.CPP/include/behaviortree_cpp/json_export.h:117: error: ‘nonstd::expected_lite’ has not been declared; did you mean ‘nonstd::unexpected_type’? [-Wtemplate-body] In file included from /home/vincent/BehaviorTree.CPP/src/blackboard.cpp:3: /home/vincent/BehaviorTree.CPP/include/behaviortree_cpp/json_export.h: In member function ‘BT::Expected BT::JsonExporter::fromJson(const nlohmann::json_abi_v3_11_3::json&) const’: /home/vincent/BehaviorTree.CPP/include/behaviortree_cpp/json_export.h:117:20: error: ‘nonstd::expected_lite’ has not been declared; did you mean ‘nonstd::unexpected_type’? [-Wtemplate-body]
117 | return nonstd::expected_lite::make_unexpected(res.error());
| ^~~~~~~~~~~~~

Compilation fails if cxx_std_17 is changed to cxx_std_23 because expected_lite namespace is not defined. Commit fixes this.

/home/vincent/BehaviorTree.CPP/include/behaviortree_cpp/json_export.h:117: error: ‘nonstd::expected_lite’ has not been declared; did you mean ‘nonstd::unexpected_type’? [-Wtemplate-body]
In file included from /home/vincent/BehaviorTree.CPP/src/blackboard.cpp:3:
/home/vincent/BehaviorTree.CPP/include/behaviortree_cpp/json_export.h: In member function ‘BT::Expected<T> BT::JsonExporter::fromJson(const nlohmann::json_abi_v3_11_3::json&) const’:
/home/vincent/BehaviorTree.CPP/include/behaviortree_cpp/json_export.h:117:20: error: ‘nonstd::expected_lite’ has not been declared; did you mean ‘nonstd::unexpected_type’? [-Wtemplate-body]
  117 |     return nonstd::expected_lite::make_unexpected(res.error());
      |                    ^~~~~~~~~~~~~
@facontidavide facontidavide merged commit a44619c into BehaviorTree:master Feb 9, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants