This is the mail archive of the gcc-patches@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]

Re: Confusing error message


Carlo Wood wrote:
> [confusing error message from defining a function in a declared,
> but undefined class]
Yes, it would be better, and here's a patch.

Whilst we're on the issue, what do people think about also reporting
where the declaration of class A is?, ie

nodefn.ii:4: invalid use of undefined type `class A'
nodefn.ii:1: declaration of `class A'

This goes for other cases of reporting undefined type abuses too.

nathan
-- 
Dr Nathan Sidwell :: Computer Science Department :: Bristol University
      You can up the bandwidth, but you can't up the speed of light      
nathan@acm.org  http://www.cs.bris.ac.uk/~nathan/  nathan@cs.bris.ac.uk
egcs/gcc/cp/ChangeLog

Tue Dec 15 18:00:03 BST 1998  Nathan Sidwell  <nathan@acm.org>

	* decl2.c (check_classfn): Issue `incomplete type' error, if
	class is not defined.

Index: egcs/gcc/cp/decl2.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/decl2.c,v
retrieving revision 1.167
diff -c -3 -p -r1.167 decl2.c
*** decl2.c	1998/12/09 12:48:42	1.167
--- decl2.c	1998/12/15 17:59:43
*************** check_classfn (ctype, function)
*** 1455,1462 ****
    else
      {
        methods = 0;
!       cp_error ("no `%#D' member function declared in class `%T'",
! 		function, ctype);
      }
  
    /* If we did not find the method in the class, add it to avoid
--- 1455,1465 ----
    else
      {
        methods = 0;
!       if (TYPE_SIZE (ctype) == 0)
!         incomplete_type_error (function, ctype);
!       else
!         cp_error ("no `%#D' member function declared in class `%T'",
! 		  function, ctype);
      }
  
    /* If we did not find the method in the class, add it to avoid

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