[cfe-dev] C++ typedef merging

James Widman widman at gimpel.com
Sun Dec 2 16:20:23 PST 2007

On Dec 2, 2007, at 6:57 PM, James Widman wrote:

> Note that this rule allows just enough hiding to maintain
> compatibility with this kind of C code while rendering the following
> examples ill-formed:
> struct A {};
> namespace A{}                  // Error
> int B;
> namespace B{}                  // Error
> int C();
> template <class T> struct C{}; // Error
> template< class T> int D();
> struct D{};                    // Error

Also note, the kind of a name introduced by a using-declaration is the  
same as the kind of name to which it refers; e.g. a using-declaration  
that names a class introduces a class-name into the scope where the  
using-declaration appears.  Example:

namespace N {
   int A;
   template <class T> struct B;

struct A;
using N::A; // Ok

int B();
using N::B; // Error

James Widman
Gimpel Software

More information about the cfe-dev mailing list