This similar ill-fated question received comments and short answers, before it was closed, about: how language is defined. Here I ask for evidence in C ++ Standard, which is so defined.
gcc 4.8.1 and clang 3.3, with default diagnostic parameters or more strict, give errors for additional qualifications or explicit code, for example:
struct x { int x::i; // Error: gcc/clang: "extra" }; int ::y; // Error: gcc: "explicit", clang: "extra"
gcc diagnosed such errors since v4.1. But popular compilers are not unanimous about these errors. MSVC ++ 2012 (Nov CTP) gives an error in int ::y; , but even with /Wall does not give any diagnostics at all int x::i; - the kind of case that the ill-fated questionnaire raised - and this difference involves discussion by the MS compiler.
How are these errors guaranteed by the Standard, if any? References to C ++ 11 Standard will suffice.
The answer may be "They follow from grammar." In that case, try to show how they follow from the grammar and feel free to use the Standard Grammar Classifications. I have a copy and re-read it to understand the explanation.
source share