[PATCH] Sema: Fix spurious 'infinite recursion' warning for overloaded functions

Vedant Kumar vsk at apple.com
Wed Jul 29 21:30:20 PDT 2015


Hi Richard,

Please drop this patch.

I think the warning triggered correctly on the following snippet:

   int f(char *value);                 
   int f(const std::string &name) { return listAttr(name.c_str()); }   

I forgot that name.c_str() returns a const char*, which is implicitly converted.

vedant

On Jul 29, 2015, at 5:09 PM, Richard Trieu <rtrieu at google.com> wrote:

> Vedant,
> 
> I have tried the example in your test case and could not get a spurious warning from it.  Further, having two different functions map to the same canonical function decl would be problematic for Clang.  Can you give any more information about where you saw this spurious warning?
> 
> Richard
> 
> On Wed, Jul 29, 2015 at 4:41 PM, Vedant Kumar <vsk at apple.com> wrote:
> Sema::checkRecursiveFunction() currently cannot tell overloaded functions apart.
> 
> This results in spurious warnings -- clang claims that a function is infinitely recursive when it in fact just calls a different function. The attached patch fixes the problem by keeping the original FunctionDecl around, instead of switching to the 'canonical' decl.
> 
> I don't have commit rights, so I'd appreciate someone taking a look at the patch and guiding it into trunk :).
> 
> vedant
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
> 
> 





More information about the cfe-commits mailing list