[Bug c++/18635] use of uninitialised reference accepted in C++ front end

llib at computer dot org gcc-bugzilla@gcc.gnu.org
Fri Nov 26 02:56:00 GMT 2004


------- Additional Comments From llib at computer dot org  2004-11-26 02:56 -------
int &a = a;
i don't believe this is valid code.  i believe g++ should reject the code.
various comp.std.c++ people agree with me.

8.3.2/4 states "[...] A reference shall be initialized to refer to a valid
object or function."

surely a (the right-hand-side) is not a valid object or function since it has
not been initialised, so the code is ill-formed.

-- 


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



More information about the Gcc-bugs mailing list