This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 116a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-12-19


2199. Typedefs and tags

Section: 9.2.4  [dcl.typedef]     Status: CD6     Submitter: Richard Smith     Date: 2015-11-12

[Accepted at the November, 2020 meeting as part of paper P1787R6 and moved to DR at the February, 2021 meeting.]

It is still unclear how typedefs and elaborated-type-specifiers interact in some cases. For example:

    namespace A {
      struct S {};
    }
    namespace B {
      typedef int S;
    }
    namespace C {
      using namespace A;
      using namespace B;
      struct S s; // clearly ambiguous, S names different entities
    }
    namespace D {
      using A::S;
      typedef struct S S;
      struct S s; // OK under issue 407: S could be used in an
                  //  elaborated-type-specifier before the typedef, so still can be
    }
    namespace E {
      typedef A::S S;
      using A::S;
      struct S s; // ??? the identifier S could not have been used in an
                  // elaborated-type-specifier prior to the typedef, so is this lookup
                  // ill-formed because it finds a typedef-name?
    }
    namespace F {
      typedef A::S S;
    }
    namespace G {
      using namespace A;
      using namespace F;
      struct S s; // ??? F::S could not have been used as an
                  // elaborated-type-specifier before the typedef. is this ill-formed because
                  // the lookup finds a typedef-name?
    }
    namespace H {
      using namespace F;
      using namespace A;
      struct S s; // some implementations give different answers for G and H
    }