Skip to content

<variant>: Constructor inheritance causes ICE when class in named module inherits from class imported from module std #18

Closed
@JMazurkiewicz

Description

@JMazurkiewicz

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions