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

<yvals.h> : Can't be used alongside the std module #4670

Closed
Cazayus opened this issue May 10, 2024 · 1 comment
Closed

<yvals.h> : Can't be used alongside the std module #4670

Cazayus opened this issue May 10, 2024 · 1 comment
Labels
duplicate This issue or pull request already exists modules C++23 modules, C++20 header units

Comments

@Cazayus
Copy link

Cazayus commented May 10, 2024

Describe the bug

It is currently impossible to use the yvals header with the std module
yvals.h is not a STL header, so it should not be affected by the current limitation of mixing import std and includes.

Command-line test case

C:\Temp>type repro.cpp
import std;
#define align_val_t ignore_align_val_t // only here to silence the error of issue #4666

#include <yvals.h>

C:\Temp>cl.exe /std:c++latest /EHsc /nologo /c .\repro.cpp

C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.40.33807\include\yvals.h(333): error C2011: 'std::_Uninitialized': 'enum' type redefinition
C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.40.33807\include\yvals.h(333): note: see declaration of 'std::_Uninitialized'

Expected behavior

It should compile but does not

STL version

    Microsoft Visual Studio Community 2022
    Version 17.10.0 Preview 7.0
@StephanTLavavej StephanTLavavej added duplicate This issue or pull request already exists modules C++23 modules, C++20 header units labels May 10, 2024
@StephanTLavavej
Copy link
Member

yvals.h is not a STL header

Actually, it is - <yvals.h> is one of the STL's central internal headers: (<yvals_core.h> is the "most central", but <yvals.h> is a runner-up.)

// yvals.h internal header

Being part of the STL, <yvals.h> is definitely affected by our current implementation bug/limitation of import-before-include resulting in duplicated machinery (like the internal std::_Uninitialized type).

Also, because it's an internal header, user code shouldn't directly include <yvals.h>. (This is unlike <crtdbg.h>, which is a documented Microsoft-specific header.)

I'm going to resolve this as a duplicate of #4666, even though it's a bit different, because it's the same root cause which will need the same coordinated fix between the compiler and Standard Library to make arbitrary mixing of imports and includes work.

Thanks yet again for the thorough reports! 😸

@StephanTLavavej StephanTLavavej closed this as not planned Won't fix, can't repro, duplicate, stale May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists modules C++23 modules, C++20 header units
Projects
None yet
Development

No branches or pull requests

2 participants