microsoft / microsoft/STL

Module STD : Can't use crtdbg header

Open
#4,666 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug compiler modules
Dominant language
C++
Stars
11.1k
Forks
1.7k
Avg merge
4d 15h
Merged PRs (30d)
22

Description

Describe the bug

It is currently impossible to use the crtdbg header with the std module
crtdbg.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;
#include <crtdbg.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\vcruntime_new.h(27): error C2011: 'std::align_val_t': 'unsigned enum' type redefinition
C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.40.33807\include\vcruntime_new.h(27): note: see declaration of 'std::align_val_t'

Expected behavior

It should compile but does not

STL version

    Microsoft Visual Studio Community 2022
    Version 17.10.0 Preview 7.0

Additional context

This bug looks similar on the surface (but is probably unrelated) to the mixing of std module and <intrin.h> (which has been fixed but not yet made available in previews of Visual Studio)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Use the supplied repro.cpp and cl.exe command first. Trace the interaction between import std, crtdbg.h, and vcruntime_new.h, then add or update a regression test showing that import std; followed by #include <crtdbg.h> compiles successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.