typedef-names and using-declarations
10.1.3 [dcl.typedef]
Richard Smith

Created on 2014-03-16.00:00:00, last changed 2014-07-07.00:00:00.


Date: 2014-06-15.00:00:00

Notes from the June, 2014 meeting:

CWG felt that these examples should be well-formed.

Date: 2014-03-16.00:00:00

The resolution of issue 407 does not cover cases involving using-declarations. For example:

  namespace A { struct S {}; }
  namespace B {
    // This is valid per issue 407
    using A::S;
    typedef A::S S;
    struct S s;
  namespace C {
    // The typedef does not redefine the name S in this
    // scope, so issue 407's resolution does not apply.
    typedef A::S S;
    using A::S;
    // The name lookup here isn't ambiguous, because it only finds one
    // entity, but it finds both a typedef-name and a non-typedef-name referring
    // to that entity, so the standard doesn't appear to say whether this is valid.
    struct S s;

The same issue appears with using-directives:

  namespace D { typedef A::S S; }
  namespace E {
    using namespace A;
    using namespace D;
    struct S s; // ok? issue 407 doesn't apply here either

One possibility might be to remove the rule that a typedef-name declaration redefines an already-defined name and instead rely on struct stat-style hiding, taking the non-typedef-name if name lookup finds both and they refer to the same type.

Date User Action Args
2014-07-07 00:00:00adminsetmessages: + msg5102
2014-03-16 00:00:00admincreate