[cfe-commits] Note and FixIt for additional case of vexing parse

Richard Smith richard at metafoo.co.uk
Mon Jul 23 14:49:14 PDT 2012


On Thu, Jul 19, 2012 at 4:52 AM, Nikola Smiljanic <popizdeh at gmail.com>wrote:

> I'm almost done, but some tests are failing because the call to
> D.isFunctionDeclarator() is not in the outside 'if'. It doesn't filter out
> pointers to member functions, functions with no parameters and a reference
> return type (these can't be variable declarations),


These cases were previously blocked by the D.getNumTypeObjects() == 1
check. I think the best (conservative) way to proceed is:
* Suppress the diagnostic if there's a type object other than a pointer or
paren before the function chunk. (You may as well determine whether to
produce the 'function declaration' or 'function declarator' diagnostic as
part of this check.)
* If the return type is a reference, do not warn if the function has no
arguments.
* If the return type is not a class type, do not warn if the function has
more than one argument.


> the last one I don't even understand.


This is checking we don't warn about the ambiguity between a
trailing-return-type and a member-access expression on a temporary (we can
tell them apart based on whether 'auto' is used). We were missing
tok::arrow from the list of token kinds in isCXXFunctionDeclarator which
indicate that a declaration is definitely a function declaration. Fixed in
r160646.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120723/12b0adbc/attachment.html>


More information about the cfe-commits mailing list