[Bug c++/38517] At definition of the empty reference the error is not output.

2008-12-15 Thread lisp2d at lisp2d dot net


--- Comment #3 from lisp2d at lisp2d dot net  2008-12-16 05:52 ---
More exact example:

.h:

extern int& i;

.cpp:

int& i; // ok


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38517



[Bug c++/38517] At definition of the empty reference the error is not output.

2008-12-15 Thread pinskia at gcc dot gnu dot org


--- Comment #2 from pinskia at gcc dot gnu dot org  2008-12-16 00:12 ---
extern int &i;
is valid though.  Note in C, int i; is a tentative definition while in C++,
there is no such thing as a tentative definition so it is normal definition and
therefor since it is a reference type variable, it has to be initialized.


-- 

pinskia at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|UNCONFIRMED |WAITING


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38517



[Bug c++/38517] At definition of the empty reference the error is not output.

2008-12-15 Thread pinskia at gcc dot gnu dot org


--- Comment #1 from pinskia at gcc dot gnu dot org  2008-12-16 00:11 ---
t.c:1: error: 'i' declared as reference but not initialized

Why do you think this is valid code?  Reference variables have to be
initialized.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38517