struct bug
{
int & A;
};
int main()
{
int C = 10;
bug B[5]; // <---- uninitialized reference
B[0].A = C; // <---- crash
}
compiled with
gcc -o bug bug.cpp
withouth errors (the uninitialized reference is not signaled)
class bug
{
int & A;
};
int main()
{
int C = 10;
bug B[5]; // <---- uninitialized reference
B[0].A = C; // <---- crash
}
compiled with
gcc -o bug bug.cpp
withouth errors (the uninitialized reference is not signaled)
class bug
{
public:
int & A;
bug() {};
~bug() {};
};
int main()
{
int C = 10;
bug B[5]; // <---- uninitialized reference
B[0].A = C; // <---- crash
}
compiled with
gcc -o bug bug.cpp
bug.cpp: In constructor bug::bug():
bug.cpp:8: error: uninitialized reference member bug::A
The uninitialized reference must be signaled in the first two cases ? I am not
sure, so i report it
( g++ same behaviour )
Here gcc -v
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla
--enable-bootstrap --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk
--disable-dssi --enable-plugin
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre
--enable-libgcj-multifile --enable-java-maintainer-mode
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib
--with-cpu=generic --build=i386-redhat-linux
Thread model: posix
gcc version 4.3.2 20081105 (Red Hat 4.3.2-7) (GCC)
--
Summary: undefined reference not signaled
Product: gcc
Version: 4.3.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: asmprog32 at hotmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39966