This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/36695] New: [4.4 Regression] Value-initialization of reference type is allowed.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]