On Fri, Mar 25, 2011 at 02:34:30PM +0100, Sebastian Redl wrote:
> namespace ns1 {
>   extern "C++" {
>     using namespace ns2;
>   }
> }
> 
> What you have to do is call DeclContext::getEnclosingNamespaceContext() on 
> the context that contains the using directive, and check whether that is a 
> TranslationUnitDecl or a NamespaceDecl.

I don't think that's right either, as now you would warn on this:

void foo() {
  using namespace ns2;
}

I believe the correct thing to do is to iterate through
declaration context parents until you reach something that is not a
LinkageSpecDecl, and warn if it is a TranslationUnitDecl.

Thanks,
-- 
Peter
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to