Consider the following sample code:

#> cat tst.cc
class C
{
 int x

 const int foo() { return x; }
};


Clang generates the following diagnostics:


#> clang tst.cc
tst.cc:3:8: error: expected ';' at end of declaration list
 int x
      ^
      ;
1 diagnostic generated.


By comparison, gcc generates:


#> ./install/bin/gcc tst.cc
tst.cc:5:3: error: expected ‘;’ before ‘const’
tst.cc:6:1: error: expected ‘;’ before ‘}’ token


gcc should associate the first diagnostic with the end of line number 3, not
the beginning of 5, and the second diagnostic is nonsensical.


-- 
           Summary: Generate clear diagnostics when a terminating semicolon
                    is missing from a class member declaration.
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: aaw at gcc dot gnu dot org


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

Reply via email to