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

Include <memory> for std::unique_ptr #788

Merged
merged 1 commit into from
Jun 4, 2024
Merged

Conversation

cpeterso
Copy link
Contributor

@cpeterso cpeterso commented Jun 4, 2024

LLVM's libc++ is removing transitive inclusions among std header files in newer C++ versions, so user code must explicitly include needed std header files. In this case, cubeb_opensl.cpp must explicitly include <memory> for std::unique_ptr because, starting in C++23, <vector> no longers includes <memory>.

https://libcxx.llvm.org/DesignDocs/HeaderRemovalPolicy.html

libcubeb/src/cubeb_opensl.cpp:140:8: error: no template named 'unique_ptr' in namespace 'std'
  140 |   std::unique_ptr<cubeb_stream_params> input_params;
      |   ~~~~~^

LLVM's libc++ is removing transitive inclusions among std header files in newer C++ versions, so user code must explicitly include needed std header files. In this case, cubeb_opensl.cpp must explicitly include <memory> for `std::unique_ptr` because, starting in C++23, <vector> no longers includes <memory>.

https://libcxx.llvm.org/DesignDocs/HeaderRemovalPolicy.html

```
libcubeb/src/cubeb_opensl.cpp:140:8: error: no template named 'unique_ptr' in namespace 'std'
  140 |   std::unique_ptr<cubeb_stream_params> input_params;
      |   ~~~~~^
```
@cpeterso
Copy link
Contributor Author

cpeterso commented Jun 4, 2024

I hit this compilation error when trying to compile Firefox with -std=c++23 (bug 1880762).

@padenot padenot merged commit 42cf706 into mozilla:master Jun 4, 2024
15 checks passed
@padenot
Copy link
Collaborator

padenot commented Jun 4, 2024

Thanks Chris!

@cpeterso cpeterso deleted the cxx23 branch June 5, 2024 03:33
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