https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107044
--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> --- Reduced test-case: cat pr107044.C class Token; struct { void addElement(Token *); } * fTokens; class RangeToken; struct Token { virtual void addRange(); virtual void mergeRanges(const Token *); }; inline void Token::mergeRanges(const Token *) {} RangeToken *createRange(bool = false); struct RangeToken : Token { RangeToken(); void mergeRanges(const Token *); }; RangeToken *createRange(bool isNegRange) { RangeToken *tmpTok = isNegRange ? new RangeToken : new RangeToken; fTokens->addElement(tmpTok); return tmpTok; } Token getGraphemePattern() { Token *base_char = createRange(); base_char->mergeRanges(0); }