Opened 9 years ago

Closed 9 years ago

#9267 closed Bugs (duplicate)

flat_set and flat_map can't compile in VS2013 (variadic templates activated)

Reported by: mjklaim@… Owned by: Ion Gaztañaga
Milestone: To Be Determined Component: container
Version: Boost Development Trunk Severity: Problem
Keywords: Cc:

Description

I experimented the following:

In a fresh copy of boost trunk r86347, I made the following change:

  1. go in boost/config/compiler/visualc.hpp
  2. replace
// 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
#  define BOOST_NO_CXX11_RAW_LITERALS
#  define BOOST_NO_CXX11_TEMPLATE_ALIASES
#  define BOOST_NO_CXX11_TRAILING_RESULT_TYPES
#  define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
#endif

// variadic templates are supposed to be supported by VC++ 12
// but VC++ 12 RC variadic support is causing boost regression
// test failures for signals2 and several of its dependencies.
#define BOOST_NO_CXX11_VARIADIC_TEMPLATES

by


// 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
#  define BOOST_NO_CXX11_RAW_LITERALS
#  define BOOST_NO_CXX11_TEMPLATE_ALIASES
#  define BOOST_NO_CXX11_TRAILING_RESULT_TYPES
#  define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
// variadic templates are supposed to be supported by VC++ 12
// but VC++ 12 RC variadic support is causing boost regression
// test failures for signals2 and several of its dependencies.
#  define BOOST_NO_CXX11_VARIADIC_TEMPLATES
#endif


  1. compile boost with vc12 - no error in the log, I checked this time but I didn't try to run the tests;

Doing this fixes synchronized_value for me.

However, there is a strange compilation error I can't decipher with flat_set and flat_map. Compiling:

#include <boost/container/flat_map.hpp>

boost::container::flat_map<int, int> foo;

Generates the following error (please ignore the file names, I replaced all the code by the code above):

1>e:\projects\sdk\boost\boost\include\boost-1_55\boost\intrusive\detail\has_member_function_callable_with.hpp(200): error C2228: left of '.select_on_container_copy_construction' must have class/struct/union
1>          type is 'boost::move_detail::add_rvalue_reference<U>::type'
1>          e:\projects\sdk\boost\boost\include\boost-1_55\boost\intrusive\detail\has_member_function_callable_with.hpp(276) : see reference to class template instantiation 'boost::container::container_detail::has_member_function_callable_with_select_on_container_copy_construction_impl<Fun,true,>' being compiled
1>          with
1>          [
1>              Fun=std::allocator<std::pair<int,int>>
1>          ]
1>          e:\projects\sdk\boost\boost\include\boost-1_55\boost\container\allocator_traits.hpp(262) : see reference to class template instantiation 'boost::container::container_detail::has_member_function_callable_with_select_on_container_copy_construction<const Alloc,>' being compiled
1>          with
1>          [
1>              Alloc=std::allocator<std::pair<int,int>>
1>          ]
1>          e:\projects\sdk\boost\boost\include\boost-1_55\boost\container\flat_map.hpp(113) : see reference to class template instantiation 'boost::container::allocator_traits<Allocator>' being compiled
1>          with
1>          [
1>              Allocator=std::allocator<std::pair<int,int>>
1>          ]
1>          e:\projects\games\netrush\netrush_projects\projects\netrush\system\view\tests\anyvalueset.cpp(288) : see reference to class template instantiation 'boost::container::flat_map<int,int,std::less<Key>,std::allocator<std::pair<Key,T>>>' being compiled
1>          with
1>          [
1>              Key=int
1>  ,            T=int
1>          ]
Build has been canceled.

With the following code:

#include <boost/container/flat_set.hpp>

boost::container::flat_set<int, int> foo;

I get these errors:

1>e:\projects\sdk\boost\boost\include\boost-1_55\boost\container\detail\flat_tree.hpp(50): error C2516: 'Compare' : is not a legal base class
1>          e:\projects\sdk\boost\boost\include\boost-1_55\boost\container\detail\flat_tree.hpp(110) : see declaration of 'Compare'
1>          e:\projects\sdk\boost\boost\include\boost-1_55\boost\container\detail\flat_tree.hpp(110) : see reference to class template instantiation 'boost::container::container_detail::flat_tree_value_compare<Compare,Value,KeyOfValue>' being compiled
1>          with
1>          [
1>              Compare=int
1>  ,            Value=int
1>  ,            KeyOfValue=boost::container::container_detail::identity<int>
1>          ]
1>          e:\projects\sdk\boost\boost\include\boost-1_55\boost\container\detail\flat_tree.hpp(170) : see reference to class template instantiation 'boost::container::container_detail::flat_tree<Key,Key,boost::container::container_detail::identity<Key>,Compare,Allocator>::Data' being compiled
1>          with
1>          [
1>              Key=int
1>  ,            Compare=int
1>  ,            Allocator=std::allocator<int>
1>          ]
1>          e:\projects\sdk\boost\boost\include\boost-1_55\boost\container\flat_set.hpp(75) : see reference to class template instantiation 'boost::container::container_detail::flat_tree<Key,Key,boost::container::container_detail::identity<Key>,Compare,Allocator>' being compiled
1>          with
1>          [
1>              Key=int
1>  ,            Compare=int
1>  ,            Allocator=std::allocator<int>
1>          ]
1>          e:\projects\games\netrush\netrush_projects\projects\netrush\system\view\tests\anyvalueset.cpp(288) : see reference to class template instantiation 'boost::container::flat_set<int,int,std::allocator<Key>>' being compiled
1>          with
1>          [
1>              Key=int
1>          ]
1>e:\projects\sdk\boost\boost\include\boost-1_55\boost\intrusive\detail\has_member_function_callable_with.hpp(200): error C2228: left of '.select_on_container_copy_construction' must have class/struct/union
1>          type is 'boost::move_detail::add_rvalue_reference<U>::type'
1>          e:\projects\sdk\boost\boost\include\boost-1_55\boost\intrusive\detail\has_member_function_callable_with.hpp(276) : see reference to class template instantiation 'boost::container::container_detail::has_member_function_callable_with_select_on_container_copy_construction_impl<Fun,true,>' being compiled
1>          with
1>          [
1>              Fun=std::allocator<int>
1>          ]
1>          e:\projects\sdk\boost\boost\include\boost-1_55\boost\container\allocator_traits.hpp(262) : see reference to class template instantiation 'boost::container::container_detail::has_member_function_callable_with_select_on_container_copy_construction<const Alloc,>' being compiled
1>          with
1>          [
1>              Alloc=std::allocator<int>
1>          ]
1>          e:\projects\sdk\boost\boost\include\boost-1_55\boost\container\vector.hpp(279) : see reference to class template instantiation 'boost::container::allocator_traits<Allocator>' being compiled
1>          with
1>          [
1>              Allocator=std::allocator<int>
1>          ]
1>          e:\projects\sdk\boost\boost\include\boost-1_55\boost\container\vector.hpp(550) : see reference to class template instantiation 'boost::container::container_detail::vector_alloc_holder<Allocator,boost::container::container_detail::integral_constant<unsigned int,1>>' being compiled
1>          with
1>          [
1>              Allocator=std::allocator<int>
1>          ]
1>          e:\projects\sdk\boost\boost\include\boost-1_55\boost\container\detail\flat_tree.hpp(167) : see reference to class template instantiation 'boost::container::vector<Value,A>' being compiled
1>          with
1>          [
1>              Value=int
1>  ,            A=std::allocator<int>
1>          ]
Build has been canceled.


So I'm not sure if it's related to variadic templates activated or not but it don't look so.

Change History (6)

comment:1 by anonymous, 9 years ago

Any updates on this?

comment:2 by Ion Gaztañaga, 9 years ago

I think it's fixed in Git develop branch, but I have no access to Visual 2013 to test it and regression tests are still broken due to the Git switch.

comment:3 by anonymous, 9 years ago

Ok, thanks for the update.

I uncovered this as well which says it's been fixed: https://svn.boost.org/trac/boost/ticket/9332

comment:4 by mjklaim@…, 9 years ago

I think it's fixed (I'm the reporter), I use a more recent trunk revision from svn with VS2013 and have been doing so for several months, no problem anymore.

comment:5 by anonymous, 9 years ago

And I too can confirm applying the patch in 9332 fixes the issue.

comment:6 by Ion Gaztañaga, 9 years ago

Resolution: duplicate
Status: newclosed

Thanks for the report, marking this as duplicate of #9332

Note: See TracTickets for help on using tickets.