Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test stl_concept_covering.cpp failed in clang on Windows #24

Closed
yuxianch opened this issue Nov 25, 2019 · 1 comment · Fixed by #37
Closed

Test stl_concept_covering.cpp failed in clang on Windows #24

yuxianch opened this issue Nov 25, 2019 · 1 comment · Fixed by #37

Comments

@yuxianch
Copy link

yuxianch commented Nov 25, 2019

When running latest stl_concept_covering.cpp in clang on Windows, I got the following error message.

In file included from stl_concept_covering.cpp:6:
vs2019/VC/Tools/MSVC/14.20.27508/include\algorithm(2467,9): error: cannot decrement value of type 'boost::mutable_forward_iterator_archetype<boost::sgi_assignable_archetype<boost::convertible_to_archetype<boost::null_archetype<int>, boost::default_archetype_base> > >'
        --_Last;
        ^ ~~~~~
vs2019/VC/Tools/MSVC/14.20.27508/include\algorithm(2488,27): note: in instantiation of function template specialization 'std::_Stable_partition_unchecked<boost::mutable_forward_iterator_archetype<boost::sgi_assignable_archetype<boost::convertible_to_archetype<boost::null_archetype<int>, boost::default_archetype_base> > >, boost::unary_predicate_archetype<boost::null_archetyp
e<int> > >' requested here
    _Seek_wrapped(_First, _Stable_partition_unchecked(_Get_unwrapped(_First), _Get_unwrapped(_Last), _Pass_fn(_Pred)));
                          ^
stl_concept_covering.cpp(558,15): note: in instantiation of function template specialization 'std::stable_partition<boost::mutable_forward_iterator_archetype<boost::sgi_assignable_archetype<boost::convertible_to_archetype<boost::null_archetype<int>, boost::default_archetype_base> > >, boost::unary_predicate_archetype<boost::null_archetype<int> > >' requested here
    fi = std::stable_partition(fi, fi, pred);
              ^

I noticed these few lines would not run in msvc.

ksh-3.2$ sed -n "552,561p" stl_concept_covering.cpp
#ifndef BOOST_MSVC
  {
    // fails on MSVC
    typedef null_archetype<> PredArg;
    typedef sgi_assignable_archetype<convertible_to_archetype<PredArg> > FT;
    mutable_forward_iterator_archetype<FT> fi;
    unary_predicate_archetype<PredArg> pred(dummy_cons);
    fi = std::stable_partition(fi, fi, pred);
  }
#endif 

If this test was forced to run in msvc(cl), and there would be an similar error in line 558 too. The error message of cl looks like below.

C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.15.26726\include\algorithm(2888): error C2675: unary '--': '_BidIt' does not define this operator or a conversion to a type acceptable to the predefined operator
        with
        [
            _BidIt=boost::mutable_forward_iterator_archetype<FT>
        ]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.15.26726\include\algorithm(2914): note: see reference to function template instantiation '_BidIt std::_Stable_partition_unchecked<_Iter,_Fn>(_BidIt,_BidIt,_Pr)' being compiled
        with
        [
            _BidIt=boost::mutable_forward_iterator_archetype<FT>,
            _Iter=boost::mutable_forward_iterator_archetype<FT>,
            _Fn=boost::unary_predicate_archetype<T>,
            _Pr=boost::unary_predicate_archetype<T>
        ]
stl_concept_covering.cpp(558): note: see reference to function template instantiation '_BidIt std::stable_partition<boost::mutable_forward_iterator_archetype<FT>,boost::unary_predicate_archetype<T>>(_BidIt,_BidIt,_Pr)' being compiled
        with
        [
            _BidIt=boost::mutable_forward_iterator_archetype<FT>,
            _Pr=boost::unary_predicate_archetype<T>
        ]

So, if this is an known issue on Windows and cannot be fixed,

  1. should the macro judgement in this code segment be changed to avoid running in some other compilers on Windows, like clang-cl?
  2. is it possible to make some changes in this code to avoid errors on Windows? Still no clear why it can run on Linux but not on Windows.
    Thanks a lot!
@yuxianch
Copy link
Author

yuxianch commented Jul 3, 2020

This issue can be fixed by replacing "#ifndef BOOST_MSVC" with "#ifndef _MSC_VER".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant