Testcase:

namespace x {
  struct a { };
}

x:a a2;
x::a a3 = a2;

gcc-4.6:

clang-9.C:5:1: error: ‘x’ does not name a type
clang-9.C:6:11: error: ‘a2’ was not declared in this scope

clang:

t.cc:5:2: error: unexpected ':' in nested name specifier
x:a a2;
 ^
 ::


"In addition to getting the error message right (and suggesting a fixit
replacement to "::"), Clang "knows what you mean" so it handles the subsequent
uses of a2 correctly. GCC, in contrast, gets confused about what the error is
which leads it to emit bogus errors on every use of a2."


-- 
           Summary: improve diagnostic for :: vs : typo
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: manu at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44522

Reply via email to