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

Boost failed with error C2760 when build with permissive- by MSVC on windows #527

Closed
QuellaZhang opened this Issue Nov 9, 2018 · 5 comments

Comments

Projects
None yet
3 participants
@QuellaZhang
Copy link

QuellaZhang commented Nov 9, 2018

We tried to build and run geometry test for Boost on Windows. It failed to build due to the error C2760. Could you please help take a look at this? Thank you!

Reproduce steps:

  1. git clone -c core.autocrlf=true --recursive https://github.com/boostorg/boost.git D:\Boost\src
  2. open a VS 2017 x86 command prompt and browse to D:\Boost\src
  3. set CL=/DNOMINMAX /wd4643 /permissive-
  4. .\bootstrap
  5. .\b2 headers variant=release --build-dir=..\out\x86rel address-model=32
  6. .\b2 variant=release --build-dir=..\out\x86rel address-model=32
  7. .\b2 -j4 variant=release --build-dir=..\out\x86rel libs\geometry\test

Failures:

projection.cpp
.\boost/geometry/srs/projections/proj/fouc_s.hpp(128): error C2760: syntax error: unexpected token 'constant', expected ')'
.\boost/geometry/srs/projections/proj/healpix.hpp(728): error C2760: syntax error: unexpected token 'constant', expected ')'
@mloskot

This comment has been minimized.

Copy link
Member

mloskot commented Nov 9, 2018

You don't specify which version of Boost you are using.
Let's assume it is the current master branch, or latest release which is close to the branch.

That is one of those cryptic compiler errors difficult to reason about, but it seems plausible, the error is due to undefined BOOST_THROW_EXCEPTION macro, here

proj_parm.n = pj_get_param_f<T, srs::spar::n>(params, "n", srs::dpar::n);
if (proj_parm.n < 0. || proj_parm.n > 1.)
BOOST_THROW_EXCEPTION( projection_exception(error_n_out_of_range) );

and here

/* Check for valid north_square and south_square inputs. */
if (proj_parm.north_square < 0 || proj_parm.north_square > 3) {
BOOST_THROW_EXCEPTION( projection_exception(error_axis) );
}

That would mean, BOOST_THROW_EXCEPTION is undefined due to missing #include <boost/throw_exception.hpp>.

Could you add this #include to fouc_s.hpp and healpix.hpp, somewhere before namespace boost { namespace geometry and see if it helps?

@awulkiew

This comment has been minimized.

Copy link
Member

awulkiew commented Nov 9, 2018

It's probably caused by the compiler assuming that member access and less comparisons is template instantiation (proj_parm.n<0.||proj_parm.n>). Could you try to put parentheses around the comparisons and see if it works?

if ((proj_parm.n < 0.) || (proj_parm.n > 1.))
@QuellaZhang

This comment has been minimized.

Copy link

QuellaZhang commented Nov 12, 2018

Thank you very much! And we have been using the latest version of master branch, I found this issue in version 6b17c72.

I apply two patches separately baised on what you said. According to mloskot, Boost got same errors like above, according to awulkiew, Boost built and tested succeed. I attachment those two patches.

geometry_mloskot.patch.txt
geometry_awulkiew.patch.txt

@awulkiew

This comment has been minimized.

Copy link
Member

awulkiew commented Nov 20, 2018

Thanks for testing. I pushed workaround into develop.

@awulkiew awulkiew added this to the 1.69 milestone Nov 20, 2018

@awulkiew

This comment has been minimized.

Copy link
Member

awulkiew commented Nov 26, 2018

Pushed to master for 1.69.

@awulkiew awulkiew closed this Nov 26, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment