Home Dashboard Directory Help
Search

std::aligned_union<T>::type is of insuficient size (VC11 STL) by Irish Ben


Status: 

Active


1
0
Sign in
to vote
Type: Bug
ID: 781713
Opened: 3/19/2013 3:58:45 PM
Access Restriction: Public
0
Workaround(s)
view
0
User(s) can reproduce this bug

Description


The expected output for sizeof(std::aligned_union<T>::type) is >= 24, not 16. The unexpectedly small size of std::aligned_union<T>::type results in undefined behavior if used for its intended purpose.

Specifically, the standard says in 20.9.7.6:
The member typedef type shall be a POD type suitable for use as uninitialized storage for any object whose type is listed in Types; its size shall be at least Len.

I am currently working around this by ensuring that the size supplied for Len is the maximum of sizeof of all types.
Details
Sign in to post a comment.
Posted by Microsoft on 4/29/2014 at 12:29 PM
Thank you for reporting this issue. This issue has been fixed in Visual Studio 2013. You can install a trial version of Visual Studio 2013 with the fix from: http://go.microsoft.com/?linkid=9832436
Posted by Microsoft on 5/6/2013 at 2:02 PM
Hi again,

We've fixed this bug, and the fix will be available in VC12.

Reminder: Connect doesn't notify me about comments. If you have any further questions, please E-mail me.

Stephan T. Lavavej
Senior Developer - Visual C++ Libraries
stl@microsoft.com
Posted by Microsoft on 3/26/2013 at 12:36 AM
Hi,

Thanks for reporting this bug. I wanted to let you know what's happening with it. I'm still keeping track of it, but it's been resolved as "Deferred" because we may not have time to fix it in VC12. (Note: VC8 = VS 2005, VC9 = VS 2008, VC10 = VS 2010, VC11 = VS 2012.)

Note: Connect doesn't notify me about comments. If you have any further questions, please E-mail me.

Stephan T. Lavavej
Senior Developer - Visual C++ Libraries
stl@microsoft.com
Posted by Microsoft on 3/19/2013 at 9:56 PM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.

Posted by Microsoft on 3/19/2013 at 4:52 PM
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.