C++11 declaration `::T i`?

c++, c++11

Solution

This is a specification defect. It is fixed in the latest draft, N3691 (PDF), where nested-name-specifier is:

nested-name-specifier:
    ::
    type-name ::
    namespace-name ::
    decltype-specifier ::
    nested-name-specifier identifier ::
    nested-name-specifier templateopt simple-template-id ::

(In C++11, the first production, nested-name-specifier -> `::`, is missing.)

Problem

Is the following C++11 translation unit well-formed? ``` typedef int T; ::T i; ``` If so, it doesn't appear to match the standard grammar. The `simple-type-specifier` should match `::T`, but the grammar is: ``` simple-type-specifier: nested-name-specifier_opt type-name ``` and a `nested-name-specifier` cannot match `::` alone, so `simple-type-specifier` cannot match `::T`. Is this a standard defect?

Original source