[PATCH] D16216: Fix infinite loop when ::new or ::delete are found in member initializer list

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 15 11:13:03 PST 2016

rsmith added a comment.

This isn't quite the right way to fix this issue.

Comment at: lib/Parse/ParseDeclCXX.cpp:3206-3209
@@ -3205,6 +3205,6 @@
     // we're just missing a comma.
     else if (Tok.isOneOf(tok::identifier, tok::coloncolon)) {
       SourceLocation Loc = PP.getLocForEndOfToken(PrevTokLocation);
       Diag(Loc, diag::err_ctor_init_missing_comma)
         << FixItHint::CreateInsertion(Loc, ", ");
     } else {
This is the right place to fix the bug. We should not enter this codepath if the previous initializer was not valid, and should instead fall into the `else` below to skip the rest of the initializers. (Delete the `else {` so that `MemInit` is still in scope here, and don't enter this block if `MemInit.isInvalid()`. Please also suppress the `err_expected_either` diagnostic below in that case.)


More information about the cfe-commits mailing list