MSVC 2015 compiler error

Issue #350 wontfix
Luiz Marques created an issue

Hello, Blaze team.

I succeeded using Blaze within our cross-plataform project under Linux Ubuntu 18.04 and macOS Catalina. Everything went seamlessly just following Blaze instructions. On the other hand, Windows presented some unexpected (and weird?) compilation errors that I cant’t get any clue on how to solve them. Please help!

Platform info: Windows 10 64 bits, MSVC 2015 Community Edition, CMake 3.17.1, Intel MKL 2017, Boost 1.72

Here’s a summary of error listing, grouped by Blaze header files. I left some files out because I think their errors resemble the ones listed.

Denseiterator.h

D:\Downloads\blaze-3.7\blaze/math/dense/DenseIterator.h(228): error C2244: 'blaze::DenseIterator<Type,AF>::operator +=': unable to match function definition to an existing declaration (compiling source file D:\MASTER\neopz\Mesh\TPZSBFemElementGroup.cpp)
1> D:\Downloads\blaze-3.7\blaze/math/dense/DenseIterator.h(224): note: see declaration of 'blaze::DenseIterator<Type,AF>::operator +=' (compiling source file D:\MASTER\neopz\Mesh\TPZSBFemElementGroup.cpp)
1> D:\Downloads\blaze-3.7\blaze/math/dense/DenseIterator.h(228): note: definition (compiling source file D:\MASTER\neopz\Mesh\TPZSBFemElementGroup.cpp)
1> D:\Downloads\blaze-3.7\blaze/math/dense/DenseIterator.h(228): note: 'blaze::DenseIterator<Type,AF> &blaze::DenseIterator<Type,AF>::operator +=(ptrdiff_t) noexcept' (compiling source file D:\MASTER\neopz\Mesh\TPZSBFemElementGroup.cpp)
1> D:\Downloads\blaze-3.7\blaze/math/dense/DenseIterator.h(228): note: existing declarations (compiling source file D:\MASTER\neopz\Mesh\TPZSBFemElementGroup.cpp)
1> D:\Downloads\blaze-3.7\blaze/math/dense/DenseIterator.h(228): note: 'blaze::DenseIterator<Type,AF> &blaze::DenseIterator<Type,AF>::operator +=(ptrdiff_t) noexcept const' (compiling source file D:\MASTER\neopz\Mesh\TPZSBFemElementGroup.cpp

I highlighted what I think MSVC finds wrong. This error occurs for operators ‘-=’, ‘++’ and ‘--’, as well.

Invert.h

1>D:\Downloads\blaze-3.7\blaze/math/shims/Invert.h(155): error C3250: 'abs': declaration is not allowed in 'constexpr' function body (compiling source file D:\MASTER\neopz\Mesh\TPZSBFemElementGroup.cpp)
1>D:\Downloads\blaze-3.7\blaze/math/shims/Invert.h(155): error C3249: illegal statement or sub-expression for 'constexpr' function (compiling source file D:\MASTER\neopz\Mesh\TPZSBFemElementGroup.cpp)
1>D:\Downloads\blaze-3.7\blaze/math/shims/Invert.h(158): error C3250: 'iabs': declaration is not allowed in 'constexpr' function body (compiling source file D:\MASTER\neopz\Mesh\TPZSBFemElementGroup.cpp)
1>D:\Downloads\blaze-3.7\blaze/math/shims/Invert.h(158): error C3249: illegal statement or sub-expression for 'constexpr' function (compiling source file D:\MASTER\neopz\Mesh\TPZSBFemElementGroup.cpp)
1>D:\Downloads\blaze-3.7\blaze/math/shims/Invert.h(179): error C3250: 'abs': declaration is not allowed in 'constexpr' function body (compiling source file D:\MASTER\neopz\Mesh\TPZSBFemElementGroup.cpp)
1>D:\Downloads\blaze-3.7\blaze/math/shims/Invert.h(179): error C3249: illegal statement or sub-expression for 'constexpr' function (compiling source file D:\MASTER\neopz\Mesh\TPZSBFemElementGroup.cpp)
1>D:\Downloads\blaze-3.7\blaze/math/shims/Invert.h(182): error C3250: 'iabs': declaration is not allowed in 'constexpr' function body (compiling source file D:\MASTER\neopz\Mesh\TPZSBFemElementGroup.cpp)
1>D:\Downloads\blaze-3.7\blaze/math/shims/Invert.h(182): error C3249: illegal statement or sub-expression for 'constexpr' function (compiling source file D:\MASTER\neopz\Mesh\TPZSBFemElementGroup.cpp)
1>D:\Downloads\blaze-3.7\blaze/math/shims/Invert.h(203): error C3250: 'abs': declaration is not allowed in 'constexpr' function body (compiling source file D:\MASTER\neopz\Mesh\TPZSBFemElementGroup.cpp)
1>D:\Downloads\blaze-3.7\blaze/math/shims/Invert.h(203): error C3249: illegal statement or sub-expression for 'constexpr' function (compiling source file D:\MASTER\neopz\Mesh\TPZSBFemElementGroup.cpp)
1>D:\Downloads\blaze-3.7\blaze/math/shims/Invert.h(206): error C3250: 'iabs': declaration is not allowed in 'constexpr' function body (compiling source file D:\MASTER\neopz\Mesh\TPZSBFemElementGroup.cpp)

Sign.h

1>D:\Downloads\blaze-3.7\blaze/math/shims/Sign.h(89): error C3249: illegal statement or sub-expression for 'constexpr' function (compiling source file D:\MASTER\neopz\Mesh\TPZSBFemElementGroup.cpp)
1>D:\Downloads\blaze-3.7\blaze/math/shims/Sign.h(90): error C3249: illegal statement or sub-expression for 'constexpr' function (compiling source file D:\MASTER\neopz\Mesh\TPZSBFemElementGroup.cpp)
1>D:\Downloads\blaze-3.7\blaze/math/shims/Sign.h(87): error C3259: 'constexpr' functions can only have one return statement (compiling source file D:\MASTER\neopz\Mesh\TPZSBFemElementGroup.cpp)
1>D:\Downloads\blaze-3.7\blaze/math/shims/Sign.h(109): error C3249: illegal statement or sub-expression for 'constexpr' function (compiling source file D:\MASTER\neopz\Mesh\TPZSBFemElementGroup.cpp)
1>D:\Downloads\blaze-3.7\blaze/math/shims/Sign.h(110): error C3249: illegal statement or sub-expression for 'constexpr' function (compiling source file D:\MASTER\neopz\Mesh\TPZSBFemElementGroup.cpp)
1>D:\Downloads\blaze-3.7\blaze/math/shims/Sign.h(107): error C3259: 'constexpr' functions can only have one return statement (compiling source file D:\MASTER\neopz\Mesh\TPZSBFemElementGroup.cpp)
1>D:\Downloads\blaze-3.7\blaze/math/shims/Sign.h(129): error C3249: illegal statement or sub-expression for 'constexpr' function (compiling source file D:\MASTER\neopz\Mesh\TPZSBFemElementGroup.cpp)
1>D:\Downloads\blaze-3.7\blaze/math/shims/Sign.h(130): error C3249: illegal statement or sub-expression for 'constexpr' function (compiling source file D:\MASTER\neopz\Mesh\TPZSBFemElementGroup.cpp)
1>D:\Downloads\blaze-3.7\blaze/math/shims/Sign.h(127): error C3259: 'constexpr' functions can only have one return statement (compiling source file D:\MASTER\neopz\Mesh\TPZSBFemElementGroup.cpp)

Comments (2)

  1. Klaus Iglberger

    Hi Luiz!

    Thanks for creating this defect report. Unfortunately Blaze does not support MSVC 2015. As stated on the bottom of the project page we support MSVC 2017 and newer. The problem with MSVC 2015 is that it does not provide support for all C++14 features, which are required by Blaze (e.g. constexpr, variable templates, and expression SFINAE). Please try a newer version of MSVC and all problems should be resolved.

    Thanks for choosing Blaze in your project.

    Best regards,

    Klaus!

  2. Luiz Marques reporter

    Thank you so much for such a quick response!

    I misinterpreted the statement that you mentioned. I inferred that you tested daily against MSVC 2017, which would be first option, but the last phrase “Other compilers are not explicitly tested, but might work with a high probability” gave me hope that MSVC 2015 could work. I made a huge mistake because I forgot that MSVC is not fully compliant with C++14, which is a Blaze 3.7 requirement! My apologies!

    As for moving on to MSVC 2017, this has been on our radar for a while and Blaze might be just the very reason for us to do it for all benefits Blaze brings along to our project! IMHO, MSVC 2015 is falling way behind in many aspects when compared to recent C++ compilers we use in Linux an macOS.

    Keep up the great job!

    Regards,

    Luiz

  3. Log in to comment