[cfe-commits] r58008 - /cfe/trunk/lib/Sema/SemaDecl.cpp

Douglas Gregor dgregor at apple.com
Wed Oct 22 16:45:22 PDT 2008


On Oct 22, 2008, at 4:08 PM, Argiris Kirtzidis wrote:

> Author: akirtzidis
> Date: Wed Oct 22 18:08:24 2008
> New Revision: 58008
>
> URL: http://llvm.org/viewvc/llvm-project?rev=58008&view=rev
> Log:
> Restrict creation of OverloadedFunctionDecl only to C++ (it was  
> getting used for invalid redeclarations on C).
>
> Modified:
>    cfe/trunk/lib/Sema/SemaDecl.cpp
>
> Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=58008&r1=58007&r2=58008&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Oct 22 18:08:24 2008
> @@ -95,7 +95,8 @@
>       IdResolver.AddShadowedDecl(TD, *I);
>       return;
>     }
> -  } else if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
> +  } else if (getLangOptions().CPlusPlus && isa<FunctionDecl>(D)) {
> +    FunctionDecl *FD = cast<FunctionDecl>(D);
>     // We are pushing the name of a function, which might be an
>     // overloaded name.
>     IdentifierResolver::iterator

I don't think this is the right fix. If we find an invalid  
redeclaration, we should just drop the redeclaration. There may still  
be uses for overloading when we're not in C++ mode (e.g., for  
<tgmath.h>).

	- Doug



More information about the cfe-commits mailing list