Opened 8 years ago

Closed 4 years ago

#10215 closed Bugs (fixed)

Defaulted functions not fully supported in VC 2013

Reported by: leek@… Owned by: John Maddock
Milestone: To Be Determined Component: config
Version: Boost Development Trunk Severity: Problem
Keywords: Cc:

Description

Hi all, Visual C++ 2013 has only partial support for defaulted functions: h t t p : / / m s d n . m i c r o s o f t . c o m / e n - u s / l i b r a r y / h h 4 0 9 2 9 3 . a s p x

I received the following error while running bjam with Visual Studio 2013 (but see further down for successful resolution):

bjam --with-python python-debugging=off threading=multi variant=release link=shared address-model=64 toolset=msvc-12.0 stage

--- hopefully irrelevant parts removed ---

.\boost/graph/detail/adjacency_list.hpp(298) : error C2610: 'boost::detail::stored_edge_property<Vertex,Property>::stored_edge_property(boost::detail::stored_edge_property<Vertex,Property> &&)' : is not a special member function which can be defaulted

.\boost/graph/detail/adjacency_list.hpp(304) : see reference to class template instantiation 'boost::detail::stored_edge_property<Vertex,Property>' being compiled


I then defined BOOST_NO_CXX_DEFAULTED_FUNCTIONS in boost/config/compilers/visualc.hpp and it appears that everything has compiled successfully. Perhaps there could be more fine-grained support for what VC 2013 supports and doesn't, but for me, it's not relevant, so here is my patch:

Index: visualc.hpp =================================================================== --- visualc.hpp (revision 86799) +++ visualc.hpp (working copy) @@ -171,7 +171,6 @@

C++11 features supported by VC++ 12 (aka 2013). #if _MSC_FULL_VER < 180020827

-# define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS

# define BOOST_NO_CXX11_DELETED_FUNCTIONS # define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS # define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS

@@ -194,6 +193,12 @@

#define BOOST_NO_CXX11_USER_DEFINED_LITERALS #define BOOST_NO_CXX11_ALIGNAS #define BOOST_NO_CXX11_INLINE_NAMESPACES

+ + Although VC 2013 claims to support defaulted functions, it + does not support the =default construct. See + h t t p : / / m s d n . m i c r o s o f t . c o m / e n - u s / l i b r a r y / h h 4 0 9 2 9 3 . a s p x + +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS

prefix and suffix headers:

Attachments (2)

visualc.hpp.diff (919 bytes ) - added by leek@… 8 years ago.
Patch to visualc.hpp
visual.diff (800 bytes ) - added by Veena 6 years ago.
Patch to boost 1.59 visualc.hpp

Download all attachments as: .zip

Change History (5)

by leek@…, 8 years ago

Attachment: visualc.hpp.diff added

Patch to visualc.hpp

comment:1 by bdavis@…, 8 years ago

I'm encountering this as well. The OpenGL wrapper library Oglplus has the option to use Boost Config instead of an empirical testing step, but boost config reports defaulted functions supported on VS 2013, even though there's only partial support. Unfortunately oglplus uses features that aren't implemented on VS 2013, resulting in a compile failure.

While a more fine grained approach might solve this, it would be complicated (how exactly do you break down all the various C++11 features into bits that are supported and bits that arent? How do downstream developers actually use that information?). I think a more conservative approach is called for. If a feature isn't fully supported, then the corresponding NO_CXX11_FEATURE_NAME define should be turned on.

You could add a 'BOOST_PARTIAL_CXX11_FEATURE_NAME' flag indicating partial support without delving into the issue of what parts are actually supported, so that downstream developers could potentially do something, knowing that by relying on a PARTIAL declaration, they were treading on thin ice.

Failing to turn on the flag when the feature isn't fully supported leads to situations like mine, where I file a bug in a library I'm using, only to discover that the upstream dev is using Boost and C++, apparently correctly, but that because my compiler only has partial support for a feature, I can't build without jumping through hoops.

comment:2 by Veena, 6 years ago

Hello,

I'm using boost 1.59 whereas my code is compiling with VS2013. I see that this patch is not present in boost-1.59 which is causing some issues. Reapplying this patch back to 1.59, the issues get resolved.

Attached is the diff. Hope this helps others who are facing similar issue

by Veena, 6 years ago

Attachment: visual.diff added

Patch to boost 1.59 visualc.hpp

comment:3 by John Maddock, 4 years ago

Resolution: fixed
Status: newclosed

Not sure when, but this appears fixed now.

Note: See TracTickets for help on using tickets.