public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/13086] New: warning: `e' has incomplete type without location
@ 2003-11-17 16:59 gcc-bugzilla at gcc dot gnu dot org
  2003-11-17 17:44 ` [Bug c++/13086] [3.3/3.4 regression] no error when calling delete on incomplete type, and no location bangerth at dealii dot org
                   ` (24 more replies)
  0 siblings, 25 replies; 26+ messages in thread
From: gcc-bugzilla at gcc dot gnu dot org @ 2003-11-17 16:59 UTC (permalink / raw)
  To: gcc-bugs

The following piece of code:

/tmp % cat -n foo.cc                                             nostromo Err 1
     1  class Exp;
     2  Exp* e;
     3  
     4  int
     5  main (void)
     6  {
     7    delete e;
     8  }

Triggers an error with 3.2, but a warning with both 3.3 and 3.4.  The warning
is:

/tmp % g++-3.2 -Wall foo.cc; echo STATUS: $?                     nostromo 17:49
foo.cc: In function `int main()':
foo.cc:2: `e' has incomplete type
foo.cc:1: forward declaration of `struct Exp'
STATUS: 1
/tmp % g++-3.3 -Wall foo.cc; echo STATUS: $?                     nostromo 17:50
foo.cc: In function `int main()':
foo.cc:2: warning: `e' has incomplete type
foo.cc:1: warning: forward declaration of `struct Exp'
STATUS: 0
/tmp % g++-3.4 -Wall foo.cc; echo STATUS: $?                     nostromo 17:50
foo.cc: In function `int main()':
foo.cc:2: AVERTISSEMENT:  e  a un type incomplet
foo.cc:1: AVERTISSEMENT: forward declaration of `struct Exp'
STATUS: 0

as you can see, the problem is that the class Exp is unknown when the
dtor is called via delete.  Nevertheless the reason for the complaints
is _never_ made explicit: it took me a while to understand that it
is the call to delete that was responsible for the warning is my Real
Life Code.  I would suggest that G++ would point to the line 7
when saying ``e' has incomplete type' instead of pointing to the
declaration of `e' (or its declaration could be added, but the current
way seem to be complaining that `e's declaration is incomplete!).

Thanks for all the good work!

Environment:
System: Linux nostromo 2.4.22 #1 SMP mer sep 17 19:49:48 CEST 2003 i686 GNU/Linux
Architecture: i686

	
host: i486-pc-linux-gnu
build: i486-pc-linux-gnu
target: i486-pc-linux-gnu
configured with: ../src/configure -v --enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --enable-debug --enable-java-gc=boehm --enable-java-awt=xlib --enable-objc-gc i486-linux

How-To-Repeat:
Compile the sample above.
------- Additional Comments From akim at epita dot fr  2003-11-17 16:58 -------
Fix:
See above.

-- 
           Summary: warning: `e' has incomplete type without location
           Product: gcc
           Version: 3.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: akim at epita dot fr
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i486-pc-linux-gnu
  GCC host triplet: i486-pc-linux-gnu
GCC target triplet: i486-pc-linux-gnu


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


^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2004-02-05 16:58 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-17 16:59 [Bug c++/13086] New: warning: `e' has incomplete type without location gcc-bugzilla at gcc dot gnu dot org
2003-11-17 17:44 ` [Bug c++/13086] [3.3/3.4 regression] no error when calling delete on incomplete type, and no location bangerth at dealii dot org
2003-11-17 17:51 ` falk dot hueffner at student dot uni-tuebingen dot de
2003-11-17 20:47 ` bangerth at dealii dot org
2003-11-17 21:44 ` [Bug c++/13086] [3.3/3.4 regression] the location of the warning message is wrong when calling delete on incomplete type pinskia at gcc dot gnu dot org
2003-11-19  4:36 ` gdr at integrable-solutions dot net
2003-11-19  9:56 ` falk at debian dot org
2003-11-20  3:16 ` gdr at integrable-solutions dot net
2003-12-24 22:14 ` gdr at gcc dot gnu dot org
2003-12-29 18:56 ` pinskia at gcc dot gnu dot org
2004-01-11  1:50 ` pinskia at gcc dot gnu dot org
2004-01-12 23:39 ` steven at gcc dot gnu dot org
2004-01-15  3:00 ` giovannibajo at libero dot it
2004-01-15 12:37 ` giovannibajo at libero dot it
2004-02-04 18:42 ` [Bug c++/13086] [3.3/3.4/3.5 " mmitchel at gcc dot gnu dot org
2004-02-05  2:48 ` cvs-commit at gcc dot gnu dot org
2004-02-05  2:49 ` cvs-commit at gcc dot gnu dot org
2004-02-05  2:51 ` cvs-commit at gcc dot gnu dot org
2004-02-05  2:52 ` cvs-commit at gcc dot gnu dot org
2004-02-05  2:55 ` [Bug c++/13086] [3.3 Regression] " giovannibajo at libero dot it
2004-02-05  2:59 ` gdr at integrable-solutions dot net
2004-02-05  3:39 ` giovannibajo at libero dot it
2004-02-05 13:22 ` cvs-commit at gcc dot gnu dot org
2004-02-05 13:24 ` cvs-commit at gcc dot gnu dot org
2004-02-05 13:25 ` giovannibajo at libero dot it
2004-02-05 16:58 ` giovannibajo at libero dot it

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).