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

msvc compile error C7631 #111

Open
UMU618 opened this issue Feb 24, 2023 · 8 comments
Open

msvc compile error C7631 #111

UMU618 opened this issue Feb 24, 2023 · 8 comments

Comments

@UMU618
Copy link

UMU618 commented Feb 24, 2023

After I upgrading msvc to latest version, get error C7631.

  • Microsoft Visual Studio Community 2022 (64-bit) - Version 17.5.0

  • Boost 1.81.0

boost\boost\log\keywords\severity.hpp(32,1): error C7631: 'boost::log::v2_mt_nt6::keywords::`anonymous-namespace'::severity': variable with internal linkage declared but not defined
@UMU618
Copy link
Author

UMU618 commented Feb 24, 2023

Boost is compiled with b2.exe cxxstd=20 link=shared runtime-link=shared address-model=64 define=_WIN32_WINNT=0x0601

@UMU618
Copy link
Author

UMU618 commented Feb 24, 2023

https://github.com/boostorg/parameter/blob/develop/include/boost/parameter/keyword.hpp#L716

    namespace                                                                \
    {                                                                        \
        ::boost::parameter::keyword<tag_namespace::name> const& name         \
            = ::boost::parameter::keyword<tag_namespace::name>::instance;    \
    }

Add static to this line can fix this issue.

@Lastique Lastique transferred this issue from boostorg/log Feb 24, 2023
@Lastique
Copy link
Member

Lastique commented Feb 24, 2023

This seems to be a compiler bug because severity is the variable definition, given that it has initializer.

Please report this to MSVC developers.

@UMU618
Copy link
Author

UMU618 commented Feb 25, 2023

Already report here

@Lastique
Copy link
Member

Lastique commented Feb 27, 2023

I have tried to build the current develop with the command you provided (plus toolset=msvc-14.3) and couldn't reproduce the error.

Could you provide a reproducer?

@UMU618
Copy link
Author

UMU618 commented Feb 28, 2023

Sorry, I can't. This problem only arises when the code is sufficiently complex. Our projects have lots of C++ 20 modules, *.ixx. I use Boost.Log in small project, it compiles.

@Patschkowski
Copy link

As the previous thread was closed by Microsoft due to not enough input being provided by the author, I opened a new one with a small reproducer:

https://developercommunity.visualstudio.com/t/error-C7631:-when-instantiating-template/10476144

@Patschkowski
Copy link

As the previous thread was closed by Microsoft due to not enough input being provided by the author, I opened a new one with a small reproducer:

https://developercommunity.visualstudio.com/t/error-C7631:-when-instantiating-template/10476144

Microsoft responded that this is not a compiler bug.

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

3 participants