Opened 10 years ago
Closed 9 years ago
#8468 closed Bugs (fixed)
Compile error on visual studio 2010/2012 using vector with custom allocator and aligned types
| Reported by: | Owned by: | Ion Gaztañaga | |
|---|---|---|---|
| Milestone: | To Be Determined | Component: | intrusive |
| Version: | Boost Release Branch | Severity: | Problem |
| Keywords: | Cc: |
Description
Using boost containers with an allocator that have a construct function I have an error saying that the type can't be aligned. This is caused by boost trying to check if is possible to call construct with the parameter that i pass. In has_member_function_callable_with_construct_impl it try to do something like that:
template<typename Fun>
struct funwrap2_construct
: Fun
{
funwrap2_construct();
using Fun::construct;
private_type construct(dont_care& , dont_care&) const;
};
struct testConstruct
{
typedef funwrap2_construct< Foo > FunWrap;
static bool const value =
sizeof(no_type) == sizeof(is_private_type( (std::declval< FunWrap > ().construct(std::declval<MyObj *>(), std::declval<const MyObj&>() ), 0)));
};
where MyObj is my aligned class and dontcare is an empty class with ellipse constructor. Ellipse can't be reference and that's why visual studio thinks that FunWrap::construct will use an aligned parameter passed on the stack.
struct dont_care should have a templated constructor like boost::any.
Attachments (1)
Change History (3)
by , 10 years ago
| Attachment: | has_member_function_callable_with.hpp.patch added |
|---|
comment:1 by , 10 years ago
comment:2 by , 9 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Fixed in develop branch. SHA-1: 6c623e8d16254ca21eb40b5a84640fa4eb5518f2* Fixed #8468. Added 64 bit prime values.

Note: No compile error is give by gcc or clang. Probably because the call is erased before type alignment check.