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]

Why did the compiler ...




Hello,

I detect a strange comportment of the compiler due to following
code lines:

   MyColorGroup myColorGroup1 ( MyColor ( ::Rgb ( 0 ) ),
                                MyColor ( ::Rgb ( 255 ) ) );
   MyColorGroup myColorGroup0 ( MyColor ( Rgb ( 0 ) ),
                                MyColor ( Rgb ( 255 ) ) );

where Rgb is declared as a typedef unsigned int in global namespace.
(Using gcc-2.95, Linux 2.2.5,
 Compiler line: gcc -o bug -Wall main.cpp -lstdc++,
 a tar archive is attached to this mail)


Output whith GNU-Compiler 2.7.2.3:
/usr/bin/gcc -v
Reading specs from /usr/lib/gcc-lib/i486-linux/2.7.2.3/specs
gcc version 2.7.2.3
/usr/bin/gcc -o bug -Wall main.cpp -lstdc++
main.cpp: In function `int main(int, char **)':
main.cpp:56: warning: unused variable `unsigned int black'
main.cpp:55: warning: unused variable `unsigned int white'
main.cpp:54: warning: unused parameter `int argc'
main.cpp:54: warning: unused parameter `char ** argv'

Output whith GNU-Compiler 2.95:
gcc -v
Reading specs from
/usr/src/gcc-2.95/lib/gcc-lib/i686-pc-linux-gnu/2.95/specs
gcc version 2.95 19990728 (release)
gcc -o bug -Wall main.cpp -lstdc++
main.cpp: In function `int main(int, char **)':
main.cpp:67: redeclaration of `class MyColor Rgb'
main.cpp:67: `class MyColor Rgb' previously declared here
main.cpp:56: warning: unused variable `Rgb black'
main.cpp:55: warning: unused variable `Rgb white'
make: *** [all] Error 1

Is it a bug or a feature?

Best regards

   Bernhard Ristow

-- 
---------------------------------------------------------------------------
                                             Dipl.-Ing. Bernhard Ristow
   Fraunhofer Gesellschaft                   Phone:  +49-6151-155 487
   Institut f. Graphische Datenverarbeitung  Fax:    +49-6151-155 499
   Rundeturmstr. 6                           E-mail: ristow@igd.fhg.de
   D-64283 Darmstadt                         WWW:   
http://www.igd.fhg.de
---------------------------------------------------------------------------


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