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

            Bug ID: 62293
           Summary: Obsure error message
           Product: gcc
           Version: 4.8.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: skvadrik at gmail dot com

Created attachment 33410
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33410&action=edit
obscure_error.h

Given the following program (file obscure_error.h):
    class A {
        inline void * f (size_t n) {return 0;}
    };

GCC generates the following error message:
    $ g++ obscure_error.h 
    obscure_error.h:3:22: error: ‘f’ declared as an ‘inline’ field
         inline void * f (size_t n) {return 0;}
                      ^
    obscure_error.h:3:19: error: expected ‘;’ at end of member declaration
         inline void * f (size_t n) {return 0;}
                   ^
    obscure_error.h:3:29: error: expected ‘)’ before ‘n’
         inline void * f (size_t n) {return 0;}
                                 ^

It would do a better job reporting something like:
    $ g++ good_error.h 
    good_error.h:3:20: error: ‘size_t’ has not been declared
         inline void f (size_t n) {}
                        ^
Which it does if I slightly modify source (file good_error.h):
    class A {
        inline void f (size_t n) {}
    };

Reply via email to