hanickadot / compile-time-regular-expressions

Compile Time Regular Expression in C++
https://twitter.com/hankadusikova
Apache License 2.0
3.32k stars 183 forks source link

ICE on MSVC #255

Open jeremy-rifkin opened 2 years ago

jeremy-rifkin commented 2 years ago

I'm getting an internal compiler error on MSVC with the current code in trunk: https://godbolt.org/z/jexjEsj61

https://raw.githubusercontent.com/hanickadot/compile-time-regular-expressions/5b914a62c71c6c6b336fd466a4e812db635b9fdc/single-header/ctre.hpp(5114): fatal error C1001: Internal compiler error.
(compiler file 'd:\a01\_work\49\s\src\vctools\Compiler\CxxFE\sl\p1\c\constexpr\constexpr.cpp', line 8618)
 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
https://raw.githubusercontent.com/hanickadot/compile-time-regular-expressions/5b914a62c71c6c6b336fd466a4e812db635b9fdc/single-header/ctre.hpp(5126): note: see reference to class template instantiation 'ctre::regex_builder<ctll::fixed_string<9> const `std::basic_string<char,std::char_traits<char>,std::allocator<char> > __cdecl asserts::utility::strip_colors(std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &)'::`2'::ansi_escape_pattern>' being compiled
<source>(10): note: see reference to variable template 'const auto search<&`asserts::utility::strip_colors'::`2'::ansi_escape_pattern>' being compiled
<source>(29): note: see reference to function template instantiation 'std::string ctre_replace<& ctll::fixed_string<9> const `std::basic_string<char,std::char_traits<char>,std::allocator<char> > __cdecl asserts::utility::strip_colors(std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &)'::`2'::ansi_escape_pattern>(std::string_view,std::string_view)' being compiled
INTERNAL COMPILER ERROR in 'C:\data\msvc\14.30.30709-v2\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

edit: goes at least as far back 2.5

hanickadot commented 2 years ago

Please report the bug to Microsoft. Internal compiler error is always a bug in compiler. Please link it here then.

jeremy-rifkin commented 2 years ago

Thank you, I will do so. I figured I'd post here in case there's any way to work around it in the library and in case it warrants updating the supported compilers section of the readme.

hanickadot commented 2 years ago

You should try latest version, it seems there is one. CTRE is tricky for compilers :)

jeremy-rifkin commented 2 years ago

Understandable :) I'm seeing it compiling fine with /std:c++20 at least!

hanickadot commented 2 years ago

yeah, you should always use /std:c++20 or higher, CTRE working in 17 mode is just a pure serendipity

jeremy-rifkin commented 2 years ago

Good to know, thanks so much for the quick reply!