Skip to content

<ranges>: Usage of ranges::iterator_t causes ICEΒ #23

@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: 83b0eb5585b6726203fb867ecdd9bda298fd38c1
  • 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\named_modules> type .\main.cpp
#ifdef USE_CLASSIC_INCLUDES
#include <concepts>
#include <ranges>
#else
import std;
#endif

int main() {
    using U = std::ranges::iterator_t<int(&)[3]>;
    static_assert(std::same_as<U, int*>);
}
PS D:\stl-playground\named_modules> $STL = "D:\stl"                                      
>> $CXXFLAGS = "/EHsc", "/nologo", "/W4", "/std:c++latest", "/MTd", "/Od", "/Femain.exe",
>>             "/reference", "$STL\std.ifc", "$STL\std.obj",
>>             "/reference", "$STL\std.compat.ifc", "$STL\std.compat.obj"
PS D:\stl-playground\named_modules> cl $CXXFLAGS .\main.cpp /DUSE_CLASSIC_INCLUDES
main.cpp
PS D:\stl-playground\named_modules> .\main.exe                                           
PS D:\stl-playground\named_modules> cl $CXXFLAGS .\main.cpp
main.cpp
.\main.cpp(9): 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
D:\stl\out\x64\out\inc\xutility(1912): note: see reference to alias template instantiation 'std::ranges::iterator_t<_Rng>' being compiled
INTERNAL COMPILER ERROR in 'C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.33.31629\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

  • This error propagates to other types:
#ifdef USE_CLASSIC_INCLUDES
#include <iterator>
#include <set>
#else
import std;
#endif

int main() {
    std::set<int> x;
    auto z = std::inserter(x, x.end());
}
PS D:\stl-playground\named_modules> cl $CXXFLAGS .\main.cpp
main.cpp
.\main.cpp(10): 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
D:\stl\out\x64\out\inc\xutility(1912): note: see reference to alias template instantiation 'std::ranges::iterator_t<_Rng>' being compiled
INTERNAL COMPILER ERROR in 'C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.33.31629\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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions