[cfe-commits] r58008 - /cfe/trunk/lib/Sema/SemaDecl.cpp
    Argiris Kirtzidis 
    akyrtzi at gmail.com
       
    Thu Oct 23 08:37:13 PDT 2008
    
    
  
Douglas Gregor wrote:
>
> <tgmath.h> is a C99 header that has several "type-generic" macros in 
> it, which are versions of common C standard library functions (acos, 
> atan, exp, etc.) whose type is the same as their input type, e.g., 
> acos(float) is a float, acos(double) is a double, etc. Now, you can't 
> actually implement <tgmath.h> in C99, so one tends to use some kind of 
> builtins. However, one possible implementation is to have a little 
> incantation that allows C++ overloading in C, and to implement 
> tgmath.h using C++ overloading. I'd like to keep that possibility open.
FYI, what triggered my commit was that C redeclarations getting 
OverloadedFunctionDecls interfered with this code:
>       // If C++, determine whether NewFD is an overload of PrevDecl or
>       // a declaration that requires merging. If it's an overload,
>       // there's no more work to do here; we'll just add the new
>       // function to the scope.
>       OverloadedFunctionDecl::function_iterator MatchedDecl;
>       if (!getLangOptions().CPlusPlus ||
>           !IsOverload(NewFD, PrevDecl, MatchedDecl)) {
>         Decl *OldDecl = PrevDecl;
>
>         // If PrevDecl was an overloaded function, extract the
>         // FunctionDecl that matched.
>         if (isa<OverloadedFunctionDecl>(PrevDecl))
>           OldDecl = *MatchedDecl;  #1
and at #1 MatchedDecl was getting used uninstantiated.
If OverloadedFunctionDecls start being lazily created, the part of the 
code that creates them will probably move out from PushOnScopeChains, so 
it doesn't seem a big deal.
-Argiris
    
    
More information about the cfe-commits
mailing list