[Bug c++/36695] New: [4.4 Regression] Value-initialization of reference type is allowed.
chris dot fairles at gmail dot com
gcc-bugzilla@gcc.gnu.org
Wed Jul 2 12:52:00 GMT 2008
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
More information about the Gcc-bugs
mailing list