Modify

Ticket #5271 (closed Bugs: fixed)

Opened 3 years ago

Last modified 3 years ago

is_convertible with 16-byte aligned types causes errors on MSVC

Reported by: mgaunard Owned by: johnmaddock
Milestone: To Be Determined Component: type_traits
Version: Boost Development Trunk Severity: Problem
Keywords: is_convertible msvc alignment Cc:

Description

This appears to be caused by passing those types by value to functions, as is done by "...". MSVC doesn't allow types with alignment higher than that of the stack to be passed by value to functions.

The fix would involve forcing everything to be references somehow.

Testcase:

#include <boost/type_traits/is_convertible.hpp>

struct A
{
    __declspec(align(16)) int value;
};

struct B
{
};

typedef boost::is_convertible<A, B>::type C;

Attachments

Change History

comment:1 Changed 3 years ago by mgaunard

It doesn't really seem fixable within the field of portable C++03, so I see three solutions:

  • use std::is_convertible or std::tr1::is_convertible if either is available
  • use the __is_convertible_to built-in on MSVC (available since 7.1)
  • use SFINAE extended to expressions, if available, to implement this trait without passing by value to a function

Solution number 2 seems to be the easiest one for a quick fix, and the one most MSVC versions will be able to benefit from.

comment:2 Changed 3 years ago by johnmaddock

  • Status changed from new to closed
  • Resolution set to fixed

(In [69822]) Change is_convertible to use C++0x behaviour where possible. Change is_converible to use MSVC is_convertible intrinsic. Fixes #5271. Fixes #4530.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.