[PATCH] Fix parsing comma in default arguments.

Olivier Goffart ogoffart at kde.org
Sun May 19 02:45:57 PDT 2013


Hi,

I attached a patch to the bug http://llvm.org/bugs/show_bug.cgi?id=14486
The problem is that a comma can be both the separation between template 
parameter, or the separation between function arguments.

GCC tries to fully parse the part after the comma to see if it can be the 
separation between function argument:
http://code.woboq.org/gcc/gcc/cp/parser.c.html#23442

But I was too lazy to do the same (because the function like 
TryParseParameterDeclarationClause or TryParseDeclarationSpecifier are not good 
enough and stop too early.)
So Instead I used some heuristics in the existence of a '=' before the 
possible closing '>' as further argument need to find a comma.

I am not 100% sure that this cover all the cases, but i could not find an 
example that breaks.

-- 
Olivier
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-parsing-comma-in-default-argument.patch
Type: text/x-patch
Size: 7768 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130519/6e265ce1/attachment.bin>


More information about the cfe-commits mailing list