mozilla / cubeb

Cross platform audio library
ISC License
434 stars 123 forks source link

Include <memory> for std::unique_ptr #788

Closed cpeterso closed 1 month ago

cpeterso commented 1 month ago

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 commented 1 month ago

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

padenot commented 1 month ago

Thanks Chris!