This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/36695] New: [4.4 Regression] Value-initialization of reference type is allowed.
- From: "chris dot fairles at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 2 Jul 2008 12:51:33 -0000
- Subject: [Bug c++/36695] New: [4.4 Regression] Value-initialization of reference type is allowed.
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
int main() { typedef int& T; T a = T(); }
Compiling the snippet above produces no diagnostic with gcc 4.4.0 20080701 or
gcc 4.1.2. However, reading n2691, 8.5 paragraph 6:
A program that calls for default-initialization or value-initialization of an
entity of reference type is ill-formed.
I'm pretty sure there's a similar statement in the current std.
Comeau seems to issue a diagnostic for the same snippet:
"ComeauTest.c", line 1: error: invalid type conversion
int main() { typedef int& T; T a = T(); }
--
Summary: [4.4 Regression] Value-initialization of reference type
is allowed.
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: chris dot fairles at gmail dot com
GCC build triplet: x86_64-unknown-linux-gnu
GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36695