Comments (9)
It looks like this will be fixed in libc++: https://bugs.llvm.org/show_bug.cgi?id=40230
from container.
Thanks for the report. This nasty pair class was used to portably support all compilers (including C++03 compilers, where std::pair had no move semantics or placement constructors.) One workaround is to embed an internal std::pair inside the dtl::pair class to guarantee excatly the same memory layout.
The second step would be to use the native std::pair on compilers withou full C++11 support.
I'll try the first workaround in the following days and inform about progress in this bug.
from container.
The first workaround is not possible because pair exposes "first" and "second" as public members. We can try to reproduce the padding in libcpp with the following patch. Could please test it, as I haven't been able to set up the virtual machine yet?
boost_container_libcpp.txt
from container.
Thanks for the patch. Unfortunately I'm getting the following error:
$ c++ test.cpp -I/tmp/boost/include
In file included from test.cpp:3:
In file included from /tmp/boost/include/container/include/boost/container/flat_map.hpp:29:
In file included from /tmp/boost/include/container/include/boost/container/detail/flat_tree.hpp:29:
/tmp/boost/include/container/include/boost/container/detail/pair.hpp:211:67: error: too many arguments provided to function-like macro invocation
: pair_padding<T1, T2, offsetof(std::pair<T1 BOOST_MOVE_I T2>, first) >
^
/usr/include/sys/cdefs.h:476:9: note: macro '__offsetof' defined here
#define __offsetof(type, field) __builtin_offsetof(type, field)
^
In file included from test.cpp:3:
In file included from /tmp/boost/include/container/include/boost/container/flat_map.hpp:29:
In file included from /tmp/boost/include/container/include/boost/container/detail/flat_tree.hpp:29:
/tmp/boost/include/container/include/boost/container/detail/pair.hpp:211:27: error: use of undeclared identifier '__offsetof'
: pair_padding<T1, T2, offsetof(std::pair<T1 BOOST_MOVE_I T2>, first) >
^
/usr/include/stddef.h:75:31: note: expanded from macro 'offsetof'
#define offsetof(type, field) __offsetof(type, field)
^
In file included from test.cpp:3:
In file included from /tmp/boost/include/container/include/boost/container/flat_map.hpp:29:
In file included from /tmp/boost/include/container/include/boost/container/detail/flat_tree.hpp:29:
/tmp/boost/include/container/include/boost/container/detail/pair.hpp:213:1: error: expected class name
{
^
3 errors generated.
Regarding the patch, I would like to suggest to check for _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR
instead of _LIBCPP_VERSION
. This will avoid possible regressions on most systems and save compile time.
from container.
It compiles with -std=c++11
but the bug is still there, I'm trying to investigate this.
EDIT: It was an error on my side. It still doesn't compile with -std=c++11
EDIT 2: It looks like a common macro problem, where the comma in std::pair< T1, T2 >
is treated as an argument separator for the macro offset_of
. This is probably why you tried to use BOOST_MOVE_I
but it didn't work.
from container.
I've reproduced the problem in Linux using clang -stdlib=libc++ and defining "_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR".
New patch attached, the patch
boost_container_pair_libcpp_patch.txt
compiles in C++03 and C++2a modes.
from container.
I confirm that the patch fixes the issue, thank you.
from container.
Many thanks for the report and help solving the issue. Fixed in commit:
from container.
There was a typo in the committed patch, corrected with commit:
from container.
Related Issues (20)
- C++20 std::erase_if
- unrecognized command-line option β-fno-limit-debug-infoβ HOT 1
- hash_value overloads can probably be removed now
- Add "piece tree" container
- Feature request: Make `static_vector` "trivially relocatable" when possible HOT 3
- Global variables HOT 1
- Support for VM based allocators/container storage
- End iterators are not dereferencable
- Ability to choose static_vector's size_type
- dtl vs std pair HOT 1
- Compiler specific header bug HOT 1
- small_vector<T> is misaligned on the stack in 32 bits HOT 2
- -Wstringop-overread emitted on simple boost small_vector code with gcc 12.3 HOT 3
- flat_multimap::emplace not sorting elements under GCC HOT 1
- flat_multimap::emplace not sorting elements under GCC HOT 6
- Modular Boost C++ Libraries Request HOT 1
- Support 'pure' (single pass) input_iterators HOT 1
- [1.85] flat_map/vector crashes on appends (memory corruption) HOT 12
- New container: chunked_vector HOT 1
- Compilation fails if custom key comparison is used HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from container.