https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120257
Bug ID: 120257 Summary: ICE (Segfault) when expanding deeply nested macros with constructor calls (std::string) since 15.1 Product: gcc Version: 16.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: mario.rodriguezb1 at um dot es Target Milestone: --- It seems to be a very specific problem, any modification in the code leads to the expected behaviour, which is "Killed - processing time exceeded". It happens in 15.1 and trunk ``` #include <iostream> using namespace std; #define NESTED(X) X(X(X(X(X(X #define NESTED2(X) NESTED(X) #define NESTED3(X) NESTED(NESTED2(X)) #define NESTED4(X) NESTED(NESTED3(X)) #define NESTED5(X) NESTED(NESTED4(X)) #define NESTED6(X) NESTED(NESTED5(X)) int main(int argc, char* argv[]) { NESTED6(string) x(2); return 0; } ``` ``` g++: internal compiler error: Segmentation fault signal terminated program cc1plus Please submit a full bug report, with preprocessed source (by using -freport-bug). See <https://gcc.gnu.org/bugs/> for instructions. Compiler returned: 4 ``` To reproduce: https://godbolt.org/z/P3h89YecG