Boost logo

Boost :

Subject: [boost] [poly_collection][VS 2017] Potential compiler bug
From: Joaquin M López Muñoz (joaquinlopezmunoz_at_[hidden])
Date: 2017-06-02 16:01:46


Hi,

Boost.PolyCollection tests have started to cycle and I found VS 2017 aka
MSVC 14.1 fails
at test_algorithm.cpp:

   http://tinyurl.com/yb4zdkys

whereas this test compiles and runs OK with VS 2015 aka MSVC 4.0
(_MSC_FULL_VER = 190023026). I've distilled down the problem to this
test case:

     #include <algorithm>
     #include <utility>

     template<typename... Ts>
     struct all_of
     {
       template<typename... Args>
       auto operator()(Args&&... args)const->
decltype(std::all_of<Ts...>(std::forward<Args>(args)...))
       {
         return std::all_of<Ts...>(std::forward<Args>(args)...);
       }
     };

     int main()
     {
       int x;
       all_of<> alg;
       alg(&x,&x,[](int){return true;});
     }

which works fine with GCC and VS 2015 but fails in webcompiler.cloudapp.net
with

   Compiled with /EHsc /nologo /W4 /c
   main.cpp
   main.cpp(9): error C3546: '...': there are no parameter packs
available to expand
   main.cpp(18): note: see reference to class template instantiation
'all_of<>' being compiled

(_MSC_FULL_VER = 191125331, which I think is VS 2017.3 or something).

This looks like a regression to me. Deleting the ->decltype(...) bit
makes the problem
go away but I need to stay within C+11.

* Can someone (STL?) confirm this is indeed a compiler bug?
* Any rewording of the code that might be generally applicable to C++11
so that I don't
have to include a specific workaround for VS 2017?

Thank you,

Joaquín M López Muñoz


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk