egcs-971225 oddity?

Dallas Morlock dallas@daktel.com
Mon Jan 5 11:40:00 GMT 1998


This test program works the same whether <utility> is included
or not.  However without <utility> the enumeration compares as a
builtin type but with <utility> the operator!= template is used.
Is this a bug?  Or is it intentional (required by the Standard)?

I'm using an Intel P90, RedHat 5.0 with patches, kernel 2.0.32,
and egcs-971225.

dallas@daktel.com

------------------------------------------------------------------------

dallas_47 cat UtilTest.cc 
#if INCLUDE_UTILITY
#include <utility>
#endif

enum Status { OK };

int
main()
{
  Status s(OK);
  if (s != OK)
  {
    // ...
  }
}
dallas_48 gcc -g UtilTest.cc -o UtilTestWithoutUtil
dallas_49 gcc -DINCLUDE_UTILITY -g UtilTest.cc -o UtilTestWithUtil
dallas_50 gdb UtilTestWithoutUtil
GDB is free software and you are welcome to distribute copies of it
 under certain conditions; type "show copying" to see the conditions.
There is absolutely no warranty for GDB; type "show warranty" for
details.
GDB 4.16 (i386-redhat-linux), Copyright 1996 Free Software Foundation,
Inc...
(gdb) b main
Breakpoint 1 at 0x804855a: file UtilTest.cc, line 10.
(gdb) run
Starting program: /home/dallas/TEST/UtilTestWithoutUtil 

Breakpoint 1, main () at UtilTest.cc:10
10        Status s(OK);
(gdb) n
11        if (s != OK)
(gdb) s
12        {
(gdb) where
#0  main () at UtilTest.cc:12
(gdb) file UtilTestWithUtil
A program is being debugged already.  Kill it? (y or n) y

Load new symbol table from "UtilTestWithUtil"? (y or n) y
Reading symbols from UtilTestWithUtil...done.
(gdb) run
Starting program: /home/dallas/TEST/UtilTestWithUtil 

Breakpoint 1, main () at UtilTest.cc:10
10        Status s(OK);
(gdb) s
11        if (s != OK)
(gdb) s
__ne__H1Z6Status_RCX01T0_b (x=@0xbffff644, y=@0xbffff640)
    at /home/dallas/egcs-971225/include/g++/stl_relops.h:38
38        return !(x == y);
(gdb) where
#0  __ne__H1Z6Status_RCX01T0_b (x=@0xbffff644, y=@0xbffff640)
    at /home/dallas/egcs-971225/include/g++/stl_relops.h:38
#1  0x8048573 in main () at UtilTest.cc:11
(gdb)



More information about the Gcc-bugs mailing list