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: tsniatowski@… 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)

std_fwd_libc++_gcc.patch (857 bytes ) - added by tsniatowski@… 7 years ago.

Download all attachments as: .zip

Change History (2)

by tsniatowski@…, 7 years ago

Attachment: std_fwd_libc++_gcc.patch added

comment:1 by Ion Gaztañaga, 7 years ago

Resolution: fixed
Status: newclosed

Thanks for the patch. Merged to master.

Note: See TracTickets for help on using tickets.