You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The other order, import std; before #include <meow>, will still cause compiler errors. We're working on a long-term solution.
We've reported the following compiler bugs; this issue is for tracking the status of these compiler bugs and removing workarounds/adding test coverage as compiler fixes are released. As you can see below, a ton of compiler bugs have been fixed. If you're using header units or named modules, I strongly recommend using the latest version of VS 2022.
As /clr C++20 support is a work in progress, we are not yet testing Standard Library Header Units or Modules under /clr.
Perma-workaround: provide a definition that calls abort().
😻 Fixed, Workaround Removed
Fixed in 16.8:
DevCom-1160043VSO-1168062 "Standard Library Header Units: Bogus error C2131 when using compare functions at compile-time"
DevCom-1160145VSO-1180193 "Standard Library Header Units: error LNK2019 'unresolved external symbol' when a function is declared in one header and defined in another"
Fixed in 16.9:
DevCom-1159869VSO-1180127 "Standard Library Header Units: Bogus warning C4373 about virtual function overriding"
DevCom-1159995VSO-1180128 "Standard Library Header Units: UDLs don't compile, depending on the order of imports"
DevCom-1160260VSO-1180207 "Standard Library Header Units: Bogus error C2752: 'std::pointer_traits<_Voidptr>': more than one partial specialization matches the template argument list"
VSO-1237145 "Standard Library Header Units: bogus error C7599: 'std::ranges::operator ==': a trailing requires clause is only allowed on a templated function"
Fixed and implemented in 16.10:
VSO-1271718 "Standard Library Header Units ICE with C++20 chrono"
<any>: error C2679: binary '!=': no operator found which takes a right-hand operand of type 'const type_info' (or there is no acceptable conversion)
<memory>: error C2679: binary '==': no operator found which takes a right-hand operand of type 'const type_info' (or there is no acceptable conversion)
<functional>: error C2027: use of undefined type 'type_info'
<typeinfo>: error C2872: 'type_info': ambiguous symbol
<typeindex>: error C2440: 'initializing': cannot convert from 'initializer list' to 'std::type_index'
VSO-1593163 "Standard Library Modules: osyncstream move assignment emits bogus error C3083: 'basic_ostream<char,std::char_traits<char> >': the symbol to the left of a '::' must be a type"
DevCom-10452770VSO-1877720 "Bug with using modules and getting error "multiple defined std::basic_string_view symbols""
DevCom-1359160VSO-1291691 "Compilation fails when both C++ Modules and Address Sanitizer are present"
Fixed in 17.10:
VSO-1592395 "Standard Library Modules: <chrono>year_month_weekday and year_month_weekday_last emit bogus error C2131: expression did not evaluate to a constant"
VSO-1555263 "Standard Library Header Units: Local array with day{31} initializers emits 'not yet implemented' internal compiler error"
VSO-1913621 "extern "C++" doesn't avoid all problems when mixing includes and imports"
VSO-1914077 "Modules: extern "C++" interferes with ADL"
DevCom-10452704VSO-1880921 "[Feedback][std:c++latest] C++ compile error when both including a header and calling std::filesystem::path::generic_string() in a module unit"
DevCom-10542001VSO-1930627 "error C1116 unrecoverable error importing module 'std' when constructing and exporting a std::chrono::zoned_time object"
StephanTLavavej
changed the title
Tracking issue for P1502R1 Standard Library Header Units
Standard Library Header Units and Modules - tracking issue
Jul 18, 2022
📜 Documentation
std
andstd.compat
std
Andstd.compat
#2930🚧 Status
std
Andstd.compat
#3108std
andstd.compat
are available when compiling in C++20 mode.#include <meow>
can coexist withimport std;
in the same translation unit, in that order.extern "C++"
as a temporary workaround for#include
/import
coexistence #4154import std;
before#include <meow>
, will still cause compiler errors. We're working on a long-term solution.We've reported the following compiler bugs; this issue is for tracking the status of these compiler bugs and removing workarounds/adding test coverage as compiler fixes are released. As you can see below, a ton of compiler bugs have been fixed. If you're using header units or named modules, I strongly recommend using the latest version of VS 2022.
As
/clr
C++20 support is a work in progress, we are not yet testing Standard Library Header Units or Modules under/clr
.❌ Clang
🐛 EDG (IntelliSense Front-End)
🪲 Active, UCRT
static inline
functions cannot be called when using modules"<ctime>
:time()
/localtime()
/mktime()
emit error C2129: static function declared but not defined StephanTLavavej/STL#21🐞 Active, C1XX (MSVC Front-End)
<filesystem>
: compiler error usingdirectory_iterator
/recursive_directory_iterator
inside a struct/class with modules #3661std
module to export too much stuff.pair(piecewise_construct_t, tuple, tuple)
"'std::_Unsigned128'
: no appropriate default constructor available"uniform_real_distribution
emits error C2512:'std::_Unsigned128'
: no appropriate default constructor available #4899generate_canonical
causes C1XX ICE:find_pending_comparison_function_for_definition(function) == std::end(pending_comparison_functions_for_definition)
"std::cout
properly"<thread>
: Usingthis_thread::sleep_for
in a module results in compilation errors #5203🛠️ Upcoming Improvements (C1XX)
❔ Possible Improvements (C1XX/MSBuild)
import std.compat;
,std::printf
, orstd::cout
"import std;
is seen, butstd.ifc
/std.obj
need to be built"import std;
andimport std.compat;
"🩹 Permanent Workarounds
std::projected::operator*()
error LNK2019: unresolved external symbol"abort()
.😻 Fixed, Workaround Removed
'std::pointer_traits<_Voidptr>'
: more than one partial specialization matches the template argument list"__pragma(warning(disable : 4996))
doesn't take effect"'std::char_traits'
"std::_Yarn<char>::operator=(char const *)
already defined"std::optional
,c1xx!FindConversionFunctions()
assertion failed:PF_ISSET(ParsingClassTemplateDefn)
"std::variant
,c1xx!Module::InterfaceReader::materialize_function()
assertion failed"'std::ranges::operator =='
: a trailingrequires
clause is only allowed on a templated function"/headerUnit:angle
ICEs"queue
'sfriend bool operator==
"/headerUnit:angle vector=vector.ifc
header-units.json
via/sourceDependencies:directives
and/translateInclude
/exportHeader /headerName:angle algorithm type_traits vector
_Nontrivial_dummy_type
's constructor"type_info
's equality operator"<format>
as a header unit"_CrtGetAllocHook
emits warning C5106: macro redefined with different parameter names"convertible_to
constrains a constructor"<ranges>
compiler assertion:previous_element == tokenInputStack.TopOfStack()
, aliastemplates.cpp 1010"template <int = 0>
tovformat()
emits warnings C4265 and C4365"#pragma warning
doesn't always suppress warnings in templates"/scanDependencies
generates incorrect"logical-name"
in JSON output"fatal error C1116: unrecoverable error importing module
, with<concepts>
"fatal error C1116: unrecoverable error importing module ''
"error C2672: 'count_if': no matching overloaded function found
"chrono::days
emits bogus error C2131"<chrono>
emits fatal error C1116: unrecoverable error importing header unit'<chrono>'
"std.ixx
emits fatal error C1011: cannot locate standard module interface"extern "C"
function declarations takingextern "C"
types emit bogus error LNK2019: unresolved external symbol"extern "C"
function mentioning entity with module linkage is being marked with module linkage"Module::InterfaceReader::materialize_function<Module::helpers::MemberBuilder>()
"construct_at
SFINAE causes Modules bogus error C2660: 'operator new': function does not take 3 arguments"<codecvt>
: fatal error C1001: Internal compiler error.<any>
: error C2679: binary'!='
: no operator found which takes a right-hand operand of type'const type_info'
(or there is no acceptable conversion)<memory>
: error C2679: binary'=='
: no operator found which takes a right-hand operand of type'const type_info'
(or there is no acceptable conversion)<functional>
: error C2027: use of undefined type'type_info'
<typeinfo>
: error C2872:'type_info'
: ambiguous symbol<typeindex>
: error C2440: 'initializing': cannot convert from 'initializer list' to'std::type_index'
<regex>
: Assertion failed:Nerrors > 0
, fileD:\msvc\src\vctools\Compiler\CxxFE\sl\p1\c\trees.c
/d1ifcInlineFunctions
asserts(bits::rep(typeEncoding.basicEncoding_) & 0x0000000F) != 0
forprintf(_Format, ...)
"<expected>
ICEs withAssertion failed: IsInClassDefn()
"'_Iterator_base12'
: the symbol to the left of a'::'
must be a type"operator&
"<ranges>
: could not use std::views::istream StephanTLavavej/STL#13 VSO-1581022 "Standard Library Modules:inline constexpr
variables forranges::views
emiterror LNK2019: unresolved external symbol
"'memcpy_s'
because it has internal linkage"extern "C++"
is directly applied to a class with a static member function"<ranges>
: ICE with std::views::join_with StephanTLavavej/STL#17 VSO-1582910 "Standard Library Modules: ICE withstd::views::join_with
"<variant>
: Constructor inheritance causes ICE when class in named module inherits from class imported frommodule std
StephanTLavavej/STL#18 VSO-1582916 "Standard Library Modules: ICE when class in named module inherits fromvariant
with inheriting constructors"chunk_view
of input iterators"inserted
, file template.cpp, line 10275"IsInClassDefn() && (region->owner == SU_TAG)
, file reader.cpp, line 2592"<fstream>
: Importing as a header unit leads to error C2079: undefined class'std::basic_ofstream<char,std::char_traits<char>>'
"destroy_at()
emits bogus error C2131: expression did not evaluate to a constant"iota_view
emits bogus error C7608: atomic constraint should be a constant expression"constexpr vector::resize()
ICE"<ranges>
: Usage ofranges::iterator_t
causes ICE StephanTLavavej/STL#23 VSO-1584629 "Standard Library Modules: Usage ofranges::iterator_t
causes ICE"<atomic>
: Building a header unit with/ZI
emits warning C5260 #3287 VSO-1706387 "<atomic>
: Building a header unit with/ZI
emits warning C5260"source_location::column()
misbehaves in user headers"'std::filesystem::_Dir_enum_impl'
: base class undefined #3333 VSO-1715231 "Standard Library Modules: Bogus error C2504:'std::filesystem::_Dir_enum_impl'
: base class undefined"charconv
gives wrong result"using namespace std::chrono;
for UDLs emits bogus error C3688: invalid literal suffix"/analyze
ICE"osyncstream
move assignment emits bogus error C3083:'basic_ostream<char,std::char_traits<char> >'
: the symbol to the left of a'::'
must be a type"sort()
emits bogus error C2065:'_Atomic_counter_t'
: undeclared identifier"<format> + <chrono>
: Could not format durations StephanTLavavej/STL#14 VSO-1582358 "Standard Library Modules:chrono
formatting emits bogus error C3861:'_Fill_tm'
: identifier not found"<chrono>
: Spurious warning C4702: unreachable code StephanTLavavej/STL#15 VSO-1582381 "Standard Library Modules: Bogus warning C4702: unreachable code"'#include <meow>'
in the purview of module'std'
appears erroneous"tuple
changes"<format>
causes C4296 warning that need to be suppressed every time" (with header units)static constexpr
data members"std::expected
error C2280 attempting to reference a deleted function"std::views::iota
in member function in module causes ICE"std::views::repeat
in member functions gives bogus error about lack ofcompare
header"'...'
: there are no parameter packs available to expand module"numeric_limits
"ctype<char>::table_size
should be a compile-time constant"std::mdspan
is unusable with C++20 modules"std::basic_string_view
symbols""<chrono>
year_month_weekday
andyear_month_weekday_last
emit bogus error C2131: expression did not evaluate to a constant"day{31}
initializers emits 'not yet implemented' internal compiler error"extern "C++"
doesn't avoid all problems when mixing includes and imports"extern "C++"
interferes with ADL"std::filesystem::path::generic_string()
in a module unit"'std'
when constructing and exporting astd::chrono::zoned_time
object"chrono::time_point
formatting emits bogus error C3861:'_Fill_tm'
: identifier not found"utc_clock::now()
emits fatal error C1116: unrecoverable error importing module'std'
."'std'
. Specialization of'std::invoke_result_t'
with arguments'_Fn, _Ty...'
"std::views::zip
withstd::views::iota
in C++20 module results in C1001 Internal compiler error"std::formatter
in module is not found in other module."'promise_type'
: is not a member of'std::coroutine_traits<TestModule::FireAndForget>'
#4826std::stacktrace
"std::format
in a module requires including<format>
header in .cpp files using that module"/Zc:preprocessor
does not terminate macro definitions properly"/scanDependencies
for header units__msvc_formatter.hpp
"🏗️ Building Deduplicated Header Units
Here's the part of our Python-powered test harness that builds "deduplicated" header units by topologically sorting them:
STL/tests/std/tests/P1502R1_standard_library_header_units/custom_format.py
Lines 56 to 109 in ef62d3f
With a bit of work, this can be extracted into a standalone Python script. (With significantly more work, it could be converted into CMake.)
The text was updated successfully, but these errors were encountered: