dash
dash copied to clipboard
cpp17/polymorphic_allocator.h is not standard complient
This file containes __attribute__((aligned())
statements, which are not standard complient.
Please fix.
any news here? thanks.
very unlucky, to get no reply here. Any one can at least give me a work around?
Yes, it appears that most people around have gone dormant. I just did a quick google on this issue. It appears there is no portable standard C++ way of specifying the alignment of a type. Can you provide details of why this is a problem and how it manifests?
The compiler refuses to compile ;-)
I'm now using this:
@@ -141,16 +141,16 @@ struct aligned_chunk<8> {
long long x;
};
template <>
-struct aligned_chunk<16> {
- __attribute__((aligned(16))) char x;
+struct alignas(16) aligned_chunk<16> {
+ char x;
};
template <>
-struct aligned_chunk<32> {
- __attribute__((aligned(32))) char x;
+struct alignas(32) aligned_chunk<32> {
+ char x;
};
template <>
-struct aligned_chunk<64> {
- __attribute__((aligned(64))) char x;
+struct alignas(64) aligned_chunk<64> {
+ char x;
};
// Adaptor to make a polymorphic allocator resource type from an STL allocator
It is described here: https://en.cppreference.com/w/cpp/language/alignas
Can you post a PR for this?
That looks good. Please post a PR.