• Wez Furlong's avatar
    folly: workaround AlignedSysAllocator vs Dual ABI issue with gcc · 22152742
    Wez Furlong authored
    Summary:
    `AlignedSysAllocator` doesn't implement the optional `rebind`
    or `size_type` portions of the C++ allocator concept.  This is ok
    in GCC if the C++11 ABI is in use but causes compilation to fail
    with errors like these:
    
    ```
    folly/Range.h: In instantiation of ‘void folly::Range<Iter>::res
    et(folly::Range<Iter>::string<Alloc>&) [with Alloc = folly::AlignedSysAllocator<char>; Iter = const char*; folly::Range<Iter>::string<Alloc> = std::
    basic_string<char, std::char_traits<char>, folly::AlignedSysAllocator<char> >]’:
    folly/test/RangeTest.cpp:235:18:   required from here
    folly/Range.h:420:27: error: ‘folly::Range<const char*>::string<
    folly::AlignedSysAllocator<char> >’ {aka ‘const class std::basic_string<char, std::char_traits<char>, folly::AlignedSysAllocator<char> >’} has no me
    mber named ‘size’
         reset(str.data(), str.size());
                           ~~~~^~~~
    ```
    
    This diff works around this issue by only compiling in the problematic
    test if the C++11 ABI is enabled.
    
    Reviewed By: yfeldblum
    
    Differential Revision: D14702585
    
    fbshipit-source-id: ea0c5fcfb0d69994d2958c2c236fe002959c824d
    22152742
RangeTest.cpp 49.4 KB