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]

found bug


Hi,

I've found a bug in EGCS 1.0.2 that maybe coexists in GCC, too. I want to
report it to the active developers of EGCS in order to support their
efforts to build this good software we all gain from.

!!! Please forward this mail to the right recipient, if it's wrong here.

Bug description:

Due to ANSI C++, the compiler implicitly generates a standard constructor
for classes which have no constructor at all.
This seems not to work in gcc when defining a const static object (which is
initialized with 0 thus is defined!) though it works with non-const objects
or when a "dumb"-constructor is provided as seen below in the code example.

Code Sample:

#include <iostream>
using namespace std;

################ err.cpp ##########################
struct Test
{
 // Test() {} should be automatically generated by the compiler
 int i;
};

const Test err;

void main()
{
 cout << err.i << endl;
}
################################################

$ gcc err.cpp -lstdc++
$ err.cpp:11: uninitialized const `err'

This compiles on other platforms such as VC++ 5.0


------------------------------------
Schumann AG - Niederlassung Köln
Dipl.-Inform. Andre Karalus
Postfach 46 01 58
D-50840 Köln
Tel:	+49-221-48 909-241
FAX:	+49-221-48 909-295
e-mail:	Andre.Karalus@Schumann-AG.de
------------------------------------


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