incomplete enums in classes

Daniel Jacobowitz drow@mvista.com
Mon Aug 19 08:56:00 GMT 2002


On Mon, Jun 03, 2002 at 10:52:30PM +0200, Stephane Chauveau wrote:
> 
> I found a problem in gdb 5.2 when debugging g++ programs.
> Enum types declared without a name within a class are incomplete.
> 
> Consider the following program:
> 
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> 
> enum TYPE1 { V1 }  ; 
> typedef enum { V2 } TYPE2 ; 
> class FOO {
> public:
> 
>   enum TYPE3 { V3  }  ;    typedef enum { V4 } TYPE4 ;  
>   int v ; } ;
> 
> enum TYPE1 a ; TYPE2 b ; enum FOO::TYPE3 c ; FOO::TYPE4 d ; 
> int
> main(void)
> {
>   a = V1 ;   b = V2 ;   c = FOO::V3 ;   d = FOO::V4 ; }
> 
> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

> (gdb) p d
> $4 = <incomplete type>

This is a bug in GCC.  It only shows up when using stabs debug
information.  Witness:

34     GSYM   0      9      00000000 1441   a:G(1,1)
35     GSYM   0      9      00000000 1450   b:G(1,2)
36     GSYM   0      9      00000000 1459   c:G(1,3)
37     GSYM   0      9      00000000 1468   d:G(1,13)=xeTYPE4:

"x" is the cross-reference descriptor; "e" implies an enum type; named
"TYPE4".  There are no other references to TYPE4 in the file.  GCC
failed to emit debug information for the enum.

You may want to report this to GCC.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer



More information about the Gdb mailing list