Closed
Description
Basic Info
- I have read the rules for the Standard Library Modules Bug Bash.
- I have pulled and rebuilt the
bug-bash
branch in the last 24 hours. - My current commit, as printed by
git rev-parse HEAD
, is:6c96fe702ab23df846cca2110bc8dc08e2aa6d3a
- This bug is:
ICE-on-valid
Command-Line Test Case
My test case that works with classic includes but fails with named modules:
PS D:\stl-playground> type .\mod.ixx
module;
#ifdef USE_CLASSIC_INCLUDES
#include <variant>
#endif
export module part;
#ifndef USE_CLASSIC_INCLUDES
import std;
#endif
using Base = std::variant<double, int>;
export struct DoubleOrInt : public Base {
using Base::Base;
};
Other source file:
PS D:\stl-playground> type .\main.cpp
import part;
int main() {
[[maybe_unused]] DoubleOrInt it_is_ice_time;
}
PS D:\stl-playground> $CXXFLAGS = '/EHsc', '/nologo', '/W4', '/std:c++latest', '/MTd', '/Od'
PS D:\stl-playground> $STL = 'D:\stl'
PS D:\stl-playground> # Correct compilation
PS D:\stl-playground> cl $CXXFLAGS /c mod.ixx /reference $STL\std.ifc /DUSE_CLASSIC_INCLUDES
mod.ixx
PS D:\stl-playground> cl $CXXFLAGS main.cpp mod.obj /reference $STL\std.ifc $STL\std.obj
main.cpp
PS D:\stl-playground> .\main.exe
PS D:\stl-playground> # Bad compilation
PS D:\stl-playground> cl $CXXFLAGS /c mod.ixx /reference $STL\std.ifc
mod.ixx
PS D:\stl-playground> cl $CXXFLAGS main.cpp mod.obj /reference $STL\std.ifc $STL\std.obj
main.cpp
main.cpp(4): fatal error C1001: Internal compiler error.
(compiler file 'msc1.cpp', line 1576)
To work around this problem, try simplifying or changing the program near the locations listed above.
If possible please provide a repro here: https://developercommunity.visualstudio.com
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information
INTERNAL COMPILER ERROR in 'C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.33.31627\bin\HostX64\x64\cl.exe'
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information
Additional Context
- I've already reported similar issue about header units: https://developercommunity.visualstudio.com/t/C20-Exporting-Importing-module-par/10078204?space=62&sort=newest&q=module. The main difference is that header units fail only when they are used in module partition (not in primary module).
- I've also tested this with some other
std::
classes:- When
Base = std::optional<T>, std::unique_ptr<T>, std::shared_ptr<T>
the ICE is present, - When
Base = std::vector<T>, std::deque<T>, std::unordered_map<T, U>
the code compiles.
- When