[cfe-dev] [PATCH] Ordinary name lookup for class and enum names in C++

Argiris Kirtzidis akyrtzi at gmail.com
Sun Apr 13 06:37:10 PDT 2008


Doug Gregor wrote:
> Also, from an implementation standpoint, it gets a little weird to
> cope with ordinary name lookup that can find multiple things in the
> same scope and then choose among them. Say we have:
>
>   void D(int);
>   class D;
>
> When performing ordinary name lookup for 'D', we'll see the class 'D'
> first. But that's not the result of name lookup; we need to skip it
> and find the function 'D' that's in the same scope. But don't consider
> things in an outer scope:
>
>   void D(int);
>
>   namespace N {
>     class D;
>   }
>   

How about modifying IdentifierResolver::AddDecl so that, when in C++ and 
decl is a RecordDecl, it looks for 'D' in normal namespace and in the 
same scope,
if a decl exists, it puts the RecordDecl on top of it in the chain:

class D
^- void D()

That way non-tag decls get precedence when searching in both tag and 
normal namespaces.


-Argiris



More information about the cfe-dev mailing list