[
https://issues.apache.org/jira/browse/THRIFT-6377?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jens Geyer resolved THRIFT-6377.
--------------------------------
Assignee: Sylwester Lachiewicz
Resolution: Fixed
> Generated C++ for a list<bool> does not compile as C++11 against libc++
> -----------------------------------------------------------------------
>
> Key: THRIFT-6377
> URL: https://issues.apache.org/jira/browse/THRIFT-6377
> Project: Thrift
> Issue Type: Bug
> Components: C++ - Compiler
> Affects Versions: 0.25.0
> Reporter: Sylwester Lachiewicz
> Assignee: Sylwester Lachiewicz
> Priority: Major
> Fix For: 0.26.0
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> Code the 0.25.0 compiler generates for a {{list<bool>}} field, directly or
> through a typedef, fails to compile with {{-std=c++11}} against libc++ (Apple
> clang 21, macOS 27):
> {noformat}
> gen-cpp/DebugProtoTest_types.cpp:2687:34: error: no member named
> 'emplace_back' in 'std::vector<bool>'
> {noformat}
> {{std::vector<bool>::emplace_back()}} exists only from C++14 on. The list
> decoder appends each element with {{emplace_back()}} since
> [ca676787c|https://github.com/apache/thrift/commit/ca676787c]; 0.24.0 indexed
> into a resized vector and compiled as C++11. C++14 and C++17 are not
> affected, and libstdc++ accepts it in C++11 mode, which is why the Linux CI
> jobs pass.
> {{make -C lib/cpp check}} stops at test/DebugProtoTest.thrift on macOS with
> the autotools build, which compiles the tests as C++11.
> Reproduce:
> {noformat}
> namespace cpp repro
> struct S { 1: list<bool> flags }
> {noformat}
> {noformat}
> thrift --gen cpp r.thrift && c++ -std=c++11 -c -I<lib/cpp/src>
> gen-cpp/r_types.cpp
> {noformat}
> Related: THRIFT-6364 would raise the minimum to C++17, which also makes this
> go away; this ticket is the generator-level fix for as long as C++11 is
> supported.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)