Home Dashboard Directory Help
Search

VC++ std::vector does not support data alignment by weibing


Status: 

Closed
 as By Design Help for as By Design


2
0
Sign in
to vote
Type: Bug
ID: 721286
Opened: 1/28/2012 2:56:19 AM
Access Restriction: Public
Moderator Decision: Sent to Engineering Team for consideration
0
Workaround(s)
view
0
User(s) can reproduce this bug

Description

_declspec(align(8))
struct test
{
};

int main()
{
    std::vector<test> f; //C2719 error.
    return 0;
}

if we modify "void resize(size_type _Newsize, _Ty _Val)" to "void resize(size_type _Newsize, const _Ty& _Val)" in file "vector", compiling will be O.K.
Details
Sign in to post a comment.
Posted by Microsoft on 2/1/2012 at 1:34 PM
Hi,

Thanks for reporting this issue. I've resolved it as By Design because our STL implementation doesn't attempt to support non-Standard "overly-aligned" types.

In this particular case, we've already changed vector::resize()'s signature to take const T& in VC11, because this changed between C++03 and C++11. In general, following C++11's requirements should probably make our implementation friendlier to overly-aligned types. However, we don't have sufficient time and resources to test and officially support overly-aligned types in VC11. That may change in the future, but not for this release.

If you have any further questions, feel free to E-mail me at stl@microsoft.com .

Stephan T. Lavavej
Visual C++ Libraries Developer
Posted by MS-Moderator10 [Feedback Moderator] on 1/29/2012 at 9:54 PM
Thank you for submitting feedback on Visual Studio 2010 and .NET Framework. Your issue has been routed to the appropriate VS development team for investigation. We will contact you if we require any additional information.
Posted by MS-Moderator01 on 1/28/2012 at 3:43 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.