Opened 7 years ago
Closed 7 years ago
#11380 closed Bugs (fixed)
Container library std forward declarations incorrect in std_fwd.hpp on libc++ with gcc
Reported by: | Owned by: | Ion Gaztañaga | |
---|---|---|---|
Milestone: | To Be Determined | Component: | container |
Version: | Boost Development Trunk | Severity: | Problem |
Keywords: | Cc: |
Description
std_fwd.hpp contains code to detect libc++ and try to forward declare some types there appropriately. However, the ifdef logic assumes that libc++ is only ever used on Clang, which is incorrect. It is possible to use libc++ with GCC, for example on Android where you generally choose the compiler and C++ library separately.
Currently, "#if defined(clang) && defined(_LIBCPP_VERSION)" is used to trigger libc++-specific style of forward declarations. Only _LIBCPP_VERSION should be checked, with a secondary clang check to disable a warning.
As a side note, shouldn't there be a build-time setting to disable this std:: forwarding altogether? It feels fragile, and borderline UB. It sacrifices portability for some potential build speed improvement, which might not be the best choice for everyone.
Attachments (1)
Change History (2)
by , 7 years ago
Attachment: | std_fwd_libc++_gcc.patch added |
---|
comment:1 by , 7 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Thanks for the patch. Merged to master.