ctpg icon indicating copy to clipboard operation
ctpg copied to clipboard

fail to compile (infinite loop, another situation)

Open nakrakiiya opened this issue 10 months ago • 0 comments

Version: latest in vcpkg (2024.12) Compiler: Microsoft (R) C/C++ Optimizing Compiler Version 19.42.34435 for x64 (latest msvc)

Code to reproduce:

#include <ctpg/ctpg.hpp>
#include <utility>

constexpr char id_pattern[] = "[_A-Za-z][_A-Za-z0-9]";
constexpr ctpg::regex_term<id_pattern> id("identifier");

constexpr char function_like_name_with_lparen_pattern[] = "[_A-Za-z][_A-Za-z0-9]*\\(";
constexpr ctpg::regex_term<function_like_name_with_lparen_pattern> function_like_name_with_lparen("function_like_name_with_lparen");

constexpr ctpg::nterm<std::string> line("line");

constexpr ctpg::parser parser(
    line,
    terms(function_like_name_with_lparen, id),
    nterms(line),
    rules(line(id) >= std::identity {}));

Messages:

C:\PROGRA~1\MIB055~1\2022\ENTERP~1\VC\Tools\MSVC\1442~1.344\bin\Hostx64\x64\cl.exe  /nologo /TP -D_CRT_SECURE_NO_WARNINGS -ID:\source\expand\src\utils -external:ID:\source\expand\out\build\Debug\vcpkg_installed\x64-windows\include -external:W0 /DWIN32 /D_WINDOWS /EHsc /Ob0 /Od /RTC1 -std:c++latest -MDd -Zi -utf-8 -W4 /showIncludes @expand\CMakeFiles\expand.dir\bug.cpp.obj.modmap /Foexpand\CMakeFiles\expand.dir\bug.cpp.obj /Fdexpand\CMakeFiles\expand.dir\ /FS -c D:\source\expand\src\expand\bug.cpp
D:\source\expand\src\expand\bug.cpp(12): error C2131: expression did not evaluate to a constant
D:\source\expand\out\build\Debug\vcpkg_installed\x64-windows\include\ctpg/ctpg.hpp(1303): note: failure was caused by evaluation exceeding step limit of 1048576 (/constexpr:steps<NUMBER>)
ninja: build stopped: subcommand failed.

nakrakiiya avatar Jan 02 '25 09:01 nakrakiiya