[teeks99-09-p-win2016-64on64][poly_collection] Regression with latest MSVC 14.1 in C++17 mode
Hi, MSVC 14.1 (_MSC_FULL_VER=191225834) in C++17 mode (_MSVC_LANG=201704L) is having a regression when compiling Boost.PolyCollection tests: http://www.boost.org/development/tests/develop/developer/output/teeks99-09-p... The problem happens in this seemingly innocent context (https://github.com/boostorg/poly_collection/blob/654018c7ce14674a1c0527206ad... ): template< typename ForwardIterator1,typename ForwardIterator2,typename Predicate > bool operator()( ForwardIterator1 first1,ForwardIterator1 last1, ForwardIterator2 first2,Predicate pred)const { ... using difference_type= typename std::iterator_traits<ForwardIterator1>::difference_type; difference_type l1=std::distance(first1,last1); // syntax error (wrongly) signalled here Is there some kind soul with access to this compiler who'd like to try the following workarounds and report the results? // workaround 1 using difference_type= typename std::iterator_traits<ForwardIterator1>::difference_type; typename difference_type l1=std::distance(first1,last1); // workaround 2 typedef typename std::iterator_traits<ForwardIterator1>::difference_type difference_type; difference_type l1=std::distance(first1,last1); Thank you! Joaquín M López Muñoz
Joaquin M López Muñoz wrote:
Is there some kind soul with access to this compiler who'd like to try the following workarounds and report the results?
// workaround 1 using difference_type= typename std::iterator_traits<ForwardIterator1>::difference_type;
typename difference_type l1=std::distance(first1,last1);
Fails with c:\boost-git\develop\libs\poly_collection\test\test_algorithm_impl.hpp(225): error C7511: 'difference_type': 'typename' keyword must be followed by a qualified name
// workaround 2 typedef typename std::iterator_traits<ForwardIterator1>::difference_type difference_type;
difference_type l1=std::distance(first1,last1);
Fails with the original error: c:\boost-git\develop\libs\poly_collection\test\test_algorithm_impl.hpp(224): error C2760: syntax error: unexpected token 'identifier', expected ';' Moving the `using` above the `not_done:` label fixes it: using difference_type= typename std::iterator_traits<ForwardIterator1>::difference_type; not_done: difference_type l1=std::distance(first1,last1); if(l1==difference_type(1))return false; You could have used Appveyor for that by the way - if you set it up to test feature branches, you can then test those changes on a branch. Like https://github.com/boostorg/smart_ptr/blob/develop/appveyor.yml for instance.
El 28/02/2018 a las 16:14, Peter Dimov via Boost escribió:
[...]
Moving the `using` above the `not_done:` label fixes it:
using difference_type= typename std::iterator_traits<ForwardIterator1>::difference_type;
not_done:
difference_type l1=std::distance(first1,last1); if(l1==difference_type(1))return false;
What a curious compiler bug! Thank you very much.
You could have used Appveyor for that by the way - if you set it up to test feature branches, you can then test those changes on a branch. Like https://github.com/boostorg/smart_ptr/blob/develop/appveyor.yml for instance.
You are right, will do. Joaquín M López Muñoz
participants (2)
-
Joaquin M López Muñoz
-
Peter Dimov