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

Fails to compile with MSVC 19.15 #48

Closed
mgieseki opened this issue Aug 15, 2018 · 5 comments
Closed

Fails to compile with MSVC 19.15 #48

mgieseki opened this issue Aug 15, 2018 · 5 comments

Comments

@mgieseki
Copy link

Microsoft managed to break the successful compilation of the variant sources again. The latest update of MS Visual Studio 2017 (version 15.8, MSVC 19.15) produces messages like these:

vartest.cpp(935): error C2131: expression did not evaluate to a constant
vartest.cpp(935): note: failure was caused by a read of a variable outside its lifetime
vartest.cpp(935): note: see usage of '<traits_0>'
vartest.cpp(1754): note: see reference to class template instantiation 'mpark::detail::traits<int>' being compiled
vartest.cpp(2053): note: see reference to class template instantiation 'mpark::detail::impl<int>' being compiled
vartest.cpp(2460): note: see reference to class template instantiation 'mpark::variant<int>' being compiled
vartest.cpp(963): error C2131: expression did not evaluate to a constant
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\include\initializer_list(42): note: failure was caused by non-constant arguments or reference to a non-constant symbol
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\include\initializer_list(42): note: see usage of '$S3'
vartest.cpp(968): error C2131: expression did not evaluate to a constant
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\include\initializer_list(42): note: failure was caused by non-constant arguments or reference to a non-constant symbol
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\include\initializer_list(42): note: see usage of '$S5'
vartest.cpp(973): error C2131: expression did not evaluate to a constant
vartest.cpp(973): note: failure was caused by a read of an uninitialized symbol
vartest.cpp(973): note: see usage of 'copy_constructible_trait'
vartest.cpp(979): error C2131: expression did not evaluate to a constant
vartest.cpp(979): note: failure was caused by a read of an uninitialized symbol
vartest.cpp(979): note: see usage of 'move_constructible_trait'
vartest.cpp(985): error C2131: expression did not evaluate to a constant
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\include\initializer_list(42): note: failure was caused by non-constant arguments or reference to a non-constant symbol
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\include\initializer_list(42): note: see usage of '$S7'
vartest.cpp(1754): error C2975: 'unnamed-parameter': invalid template argument for 'mpark::detail::copy_assignment', expected compile-time constant expression
vartest.cpp(1716): note: see declaration of 'unnamed-parameter'
vartest.cpp(1754): error C2440: 'specialization': cannot convert from 'int' to 'mpark::detail::Trait'
vartest.cpp(1754): note: Conversion to enumeration type requires an explicit cast (static_cast, C-style cast or function-style cast)
vartest.cpp(1738): error C2975: 'unnamed-parameter': invalid template argument for 'mpark::detail::move_assignment', expected compile-time constant expression
vartest.cpp(1676): note: see declaration of 'unnamed-parameter'
vartest.cpp(1754): note: see reference to class template instantiation 'mpark::detail::copy_assignment<mpark::detail::traits<int>,0>' being compiled
vartest.cpp(1738): error C2440: 'specialization': cannot convert from 'int' to 'mpark::detail::Trait'
vartest.cpp(1738): note: Conversion to enumeration type requires an explicit cast (static_cast, C-style cast or function-style cast)
vartest.cpp(1594): error C2975: 'unnamed-parameter': invalid template argument for 'mpark::detail::copy_constructor', expected compile-time constant expression
vartest.cpp(1556): note: see declaration of 'unnamed-parameter'
vartest.cpp(1698): note: see reference to class template instantiation 'mpark::detail::assignment<mpark::detail::traits<int>>' being compiled
vartest.cpp(1738): note: see reference to class template instantiation 'mpark::detail::move_assignment<mpark::detail::traits<int>,0>' being compiled
vartest.cpp(1594): error C2440: 'specialization': cannot convert from 'int' to 'mpark::detail::Trait'
vartest.cpp(1594): note: Conversion to enumeration type requires an explicit cast (static_cast, C-style cast or function-style cast)
vartest.cpp(1578): error C2975: 'unnamed-parameter': invalid template argument for 'mpark::detail::move_constructor', expected compile-time constant expression
vartest.cpp(1518): note: see declaration of 'unnamed-parameter'
vartest.cpp(1594): note: see reference to class template instantiation 'mpark::detail::copy_constructor<Traits,0>' being compiled
        with
        [
            Traits=mpark::detail::traits<int>
        ]
vartest.cpp(1578): error C2440: 'specialization': cannot convert from 'int' to 'mpark::detail::Trait'
vartest.cpp(1578): note: Conversion to enumeration type requires an explicit cast (static_cast, C-style cast or function-style cast)
vartest.cpp(1471): error C2975: 'unnamed-parameter': invalid template argument for 'mpark::detail::destructor', expected compile-time constant expression
vartest.cpp(1423): note: see declaration of 'unnamed-parameter'
vartest.cpp(1540): note: see reference to class template instantiation 'mpark::detail::constructor<mpark::detail::traits<int>>' being compiled
vartest.cpp(1578): note: see reference to class template instantiation 'mpark::detail::move_constructor<mpark::detail::traits<int>,0>' being compiled
vartest.cpp(1471): error C2440: 'specialization': cannot convert from 'int' to 'mpark::detail::Trait'
vartest.cpp(1471): note: Conversion to enumeration type requires an explicit cast (static_cast, C-style cast or function-style cast)
vartest.cpp(1472): error C2975: 'unnamed-parameter': invalid template argument for 'mpark::detail::destructor', expected compile-time constant expression
vartest.cpp(1423): note: see declaration of 'unnamed-parameter'
vartest.cpp(1472): error C2440: 'specialization': cannot convert from 'int' to 'mpark::detail::Trait'
vartest.cpp(1472): note: Conversion to enumeration type requires an explicit cast (static_cast, C-style cast or function-style cast)
vartest.cpp(1595): error C2975: 'unnamed-parameter': invalid template argument for 'mpark::detail::copy_constructor', expected compile-time constant expression
vartest.cpp(1556): note: see declaration of 'unnamed-parameter'
vartest.cpp(1595): error C2440: 'specialization': cannot convert from 'int' to 'mpark::detail::Trait'
vartest.cpp(1595): note: Conversion to enumeration type requires an explicit cast (static_cast, C-style cast or function-style cast)
vartest.cpp(1755): error C2975: 'unnamed-parameter': invalid template argument for 'mpark::detail::copy_assignment', expected compile-time constant expression
vartest.cpp(1716): note: see declaration of 'unnamed-parameter'
vartest.cpp(1755): error C2440: 'specialization': cannot convert from 'int' to 'mpark::detail::Trait'
vartest.cpp(1755): note: Conversion to enumeration type requires an explicit cast (static_cast, C-style cast or function-style cast)
@Tilka
Copy link

Tilka commented Aug 16, 2018

Probably a compiler bug. Someone already reported a similar problem.

@Mystfit
Copy link

Mystfit commented Aug 25, 2018

I can confirm this. I'm receiving the same error with Visual Studio Community 2017 15.8.1

mrkline pushed a commit to mrkline/variant that referenced this issue Aug 28, 2018
The latest Visual Studio 2017 update (version 15.8, MSVC 19.15)
claims to support C++14 constexpr, but it does not. Compiling with
MPARK_CPP14_CONSTEXPR defined emits a litany of errors, e.g.,

    5>c:\...\variant\include\mpark\variant.hpp(386): error C2131: expression did not evaluate to a constant
    5>c:\...\variant\include\mpark\variant.hpp(386): note: failure was caused by a read of a variable outside its lifetime
    5>c:\...\variant\include\mpark\variant.hpp(386): note: see usage of '<traits_0>'
    5>c:\...\variant\include\mpark\variant.hpp(1205): note: see reference to class template instantiation 'mpark::detail::traits<Redacted, Lol>' being compiled
    5>c:\...\variant\include\mpark\variant.hpp(1504): note: see reference to class template instantiation 'mpark::detail::impl<Redacted, Lol>' being compiled

Disable MPARK_CPP14_CONSTEXPR for this and previous versions of MSVC,
with the hope that this problem is addressed in the near future.

Fixes mpark#48
mgieseki added a commit to mgieseki/dvisvgm that referenced this issue Aug 30, 2018
Version 15.8 of Visual Studio 2017 introduced a compiler bug that prevents
compiling mpark::variant (mpark/variant#48).
@mpark mpark closed this as completed in #49 Oct 2, 2018
@mpark
Copy link
Owner

mpark commented Jan 14, 2019

Fixed the root cause in 657110d

@DanGroomMPG
Copy link

So... not a compiler bug?

@tomalakgeretkal
Copy link

So... not a compiler bug?

Read the commit message.

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

No branches or pull requests

6 participants