This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/16093] New: Bad error messages for missing declarations.


When a declaration is missing, the error returned by the compiler
is too confusing.  Consider the following short test case;

namespace n {
  int var;
  //class foo { };
  //template<typename T> class bar { };
}

n::var x1;
n::foo x3;
n::bar<int> x4;


The results in the following errors:

test.cc:7: error: `var' in namespace `n' does not name a type
test.cc:8: error: `foo' in namespace `n' does not name a type
test.cc:9: error: expected constructor, destructor, or type conversion before
'<' token
test.cc:9: error: expected `,' or `;' before '<' token

I'd like to suggest a different error for the case that there is
no declaration at all (this could be tested after it is already
detected that there is an error because foo is not a type):

test.cc:8: error: `foo' in namespace `n' is not declared

And of course, an improvement for templates.  For example:

test.cc:9: error: `bar' in namespace `n' is not declared

-- 
           Summary: Bad error messages for missing declarations.
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: carlo at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]