The patch/example is easier to understand than the description, perhaps.

struct foo {
  operator int[](){};
};

crashes - clang seems to be parsing 'operator int' as a member
variable name (? why is that? no type was provided before the name,
and it seems hardly likely a user would've mistakenly tried to name
their variable 'operator int' & much more likely they've messed up a
member function definition), sees the {} thinking its an in-class
initializer and the [] a deduced array bound. At this point the parser
tries to invalidate the declaration which is non-existent because of
the bogus name, and dereferences null.

Add the null check (there's a smattering of similar checks littered
around this area, so that seems like a reasonable solution - the
erroneous error recovery highlighted above not withstanding).

Thanks for the review/comments/help,
- David

Attachment: crash-on-invalid-name.diff
Description: Binary data

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to