https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87518

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The standard says:

  A name N used in a class S shall refer to the same declaration in its context
  and when re-evaluated in the completed scope of S. No diagnostic is required
  for a violation of this rule.

Before the typedef the name 't' refers to the declaration of test::t, but after
the typedef the name 't' refers to the declaration of A::t.

Even though the two declarations denote the same type, they are distinct
declarations, which violates the rule. Clang is less strict and does not
diagnose the violation of the rule.

Arguably a special case could be given to allow it when the two declarations
refer to the same entity, but since the typedef seems completely pointless
anyway I don't see any benefit to adding a special case.

Reply via email to