public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/36695]  New: [4.4 Regression] Value-initialization of reference type is allowed.
@ 2008-07-02 12:52 chris dot fairles at gmail dot com
  2008-07-04 21:55 ` [Bug c++/36695] " jsm28 at gcc dot gnu dot org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: chris dot fairles at gmail dot com @ 2008-07-02 12:52 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/36695] Value-initialization of reference type is allowed.
  2008-07-02 12:52 [Bug c++/36695] New: [4.4 Regression] Value-initialization of reference type is allowed chris dot fairles at gmail dot com
@ 2008-07-04 21:55 ` jsm28 at gcc dot gnu dot org
  2008-12-27 22:29 ` [Bug c++/36695] [4.3/4.4 Regression] " pinskia at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2008-07-04 21:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jsm28 at gcc dot gnu dot org  2008-07-04 21:54 -------
No working version named, removing regression marker.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.4 Regression] Value-     |Value-initialization of
                   |initialization of reference |reference type is allowed.
                   |type is allowed.            |


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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/36695] [4.3/4.4 Regression] Value-initialization of reference type is allowed.
  2008-07-02 12:52 [Bug c++/36695] New: [4.4 Regression] Value-initialization of reference type is allowed chris dot fairles at gmail dot com
  2008-07-04 21:55 ` [Bug c++/36695] " jsm28 at gcc dot gnu dot org
@ 2008-12-27 22:29 ` pinskia at gcc dot gnu dot org
  2008-12-28  6:49 ` pinskia at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-12-27 22:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2008-12-27 22:26 -------
Confirmed, at least a regression for 4.3 and 4.4.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |accepts-invalid
      Known to fail|                            |4.3.2 4.3.3 4.4.0
      Known to work|                            |4.1.1 4.0.2
   Last reconfirmed|0000-00-00 00:00:00         |2008-12-27 22:26:59
               date|                            |
            Summary|Value-initialization of     |[4.3/4.4 Regression] Value-
                   |reference type is allowed.  |initialization of reference
                   |                            |type is allowed.
   Target Milestone|---                         |4.3.3


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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/36695] [4.3/4.4 Regression] Value-initialization of reference type is allowed.
  2008-07-02 12:52 [Bug c++/36695] New: [4.4 Regression] Value-initialization of reference type is allowed chris dot fairles at gmail dot com
  2008-07-04 21:55 ` [Bug c++/36695] " jsm28 at gcc dot gnu dot org
  2008-12-27 22:29 ` [Bug c++/36695] [4.3/4.4 Regression] " pinskia at gcc dot gnu dot org
@ 2008-12-28  6:49 ` pinskia at gcc dot gnu dot org
  2008-12-29 21:55 ` rguenth at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-12-28  6:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2008-12-28 06:46 -------
*** Bug 35975 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gcc-bugzilla at contacts dot
                   |                            |eelis dot net


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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/36695] [4.3/4.4 Regression] Value-initialization of reference type is allowed.
  2008-07-02 12:52 [Bug c++/36695] New: [4.4 Regression] Value-initialization of reference type is allowed chris dot fairles at gmail dot com
                   ` (2 preceding siblings ...)
  2008-12-28  6:49 ` pinskia at gcc dot gnu dot org
@ 2008-12-29 21:55 ` rguenth at gcc dot gnu dot org
  2008-12-30  3:28 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-12-29 21:55 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/36695] [4.3/4.4 Regression] Value-initialization of reference type is allowed.
  2008-07-02 12:52 [Bug c++/36695] New: [4.4 Regression] Value-initialization of reference type is allowed chris dot fairles at gmail dot com
                   ` (3 preceding siblings ...)
  2008-12-29 21:55 ` rguenth at gcc dot gnu dot org
@ 2008-12-30  3:28 ` pinskia at gcc dot gnu dot org
  2008-12-30  9:52 ` jakub at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-12-30  3:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2008-12-30 03:27 -------
The patch which fixed PR 21210 caused this regression.  There needs to be an
extra check if we are moving away from using build_c_cast.  In fact reverting
that patch fixes the issue and gets us back to where we were before for this
bug plus does not regress for the other bug.  I think other patches fixed PR
21210 correctly.

Testing the reverting of the patch right now.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sayle at gcc dot gnu dot org
         AssignedTo|unassigned at gcc dot gnu   |pinskia at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
  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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/36695] [4.3/4.4 Regression] Value-initialization of reference type is allowed.
  2008-07-02 12:52 [Bug c++/36695] New: [4.4 Regression] Value-initialization of reference type is allowed chris dot fairles at gmail dot com
                   ` (4 preceding siblings ...)
  2008-12-30  3:28 ` pinskia at gcc dot gnu dot org
@ 2008-12-30  9:52 ` jakub at gcc dot gnu dot org
  2008-12-31  1:42 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-12-30  9:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jakub at gcc dot gnu dot org  2008-12-30 09:51 -------
Reverting is a bad approach.  We IMHO just want to check for
TREE_CODE (type) == REFERENCE_TYPE and issue diagnostics that references can't
be value-initialized.


-- 


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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/36695] [4.3/4.4 Regression] Value-initialization of reference type is allowed.
  2008-07-02 12:52 [Bug c++/36695] New: [4.4 Regression] Value-initialization of reference type is allowed chris dot fairles at gmail dot com
                   ` (5 preceding siblings ...)
  2008-12-30  9:52 ` jakub at gcc dot gnu dot org
@ 2008-12-31  1:42 ` pinskia at gcc dot gnu dot org
  2009-01-10 11:48 ` jakub at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-12-31  1:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pinskia at gcc dot gnu dot org  2008-12-31 01:40 -------
(In reply to comment #5)
> Reverting is a bad approach.  We IMHO just want to check for
> TREE_CODE (type) == REFERENCE_TYPE and issue diagnostics that references can't
> be value-initialized.

Yes that seems like a better idea as we can give a better error message than
before.


-- 


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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/36695] [4.3/4.4 Regression] Value-initialization of reference type is allowed.
  2008-07-02 12:52 [Bug c++/36695] New: [4.4 Regression] Value-initialization of reference type is allowed chris dot fairles at gmail dot com
                   ` (6 preceding siblings ...)
  2008-12-31  1:42 ` pinskia at gcc dot gnu dot org
@ 2009-01-10 11:48 ` jakub at gcc dot gnu dot org
  2009-01-10 11:51 ` [Bug c++/36695] [4.3 " jakub at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-01-10 11:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from jakub at gcc dot gnu dot org  2009-01-10 11:48 -------
Subject: Bug 36695

Author: jakub
Date: Sat Jan 10 11:48:06 2009
New Revision: 143244

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=143244
Log:
        PR c++/36695
        * typeck2.c (build_functional_cast): Check for reference type and NULL
        PARMS.

        * g++.dg/ext/complex4.C: New test.
        * g++.dg/ext/complex5.C: New test.
        * g++.dg/init/reference1.C: New test.
        * g++.dg/init/reference2.C: New test.
        * g++.dg/init/reference3.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/ext/complex4.C
    trunk/gcc/testsuite/g++.dg/ext/complex5.C
    trunk/gcc/testsuite/g++.dg/init/reference1.C
    trunk/gcc/testsuite/g++.dg/init/reference2.C
    trunk/gcc/testsuite/g++.dg/init/reference3.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/typeck2.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/36695] [4.3 Regression] Value-initialization of reference type is allowed.
  2008-07-02 12:52 [Bug c++/36695] New: [4.4 Regression] Value-initialization of reference type is allowed chris dot fairles at gmail dot com
                   ` (7 preceding siblings ...)
  2009-01-10 11:48 ` jakub at gcc dot gnu dot org
@ 2009-01-10 11:51 ` jakub at gcc dot gnu dot org
  2009-01-24 10:25 ` rguenth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-01-10 11:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from jakub at gcc dot gnu dot org  2009-01-10 11:50 -------
Fixed on the trunk so far.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|4.3.2 4.3.3 4.4.0           |4.3.2 4.3.3
      Known to work|4.1.1 4.0.2                 |4.1.1 4.0.2 4.4.0
            Summary|[4.3/4.4 Regression] Value- |[4.3 Regression] Value-
                   |initialization of reference |initialization of reference
                   |type is allowed.            |type is allowed.


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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/36695] [4.3 Regression] Value-initialization of reference type is allowed.
  2008-07-02 12:52 [Bug c++/36695] New: [4.4 Regression] Value-initialization of reference type is allowed chris dot fairles at gmail dot com
                   ` (8 preceding siblings ...)
  2009-01-10 11:51 ` [Bug c++/36695] [4.3 " jakub at gcc dot gnu dot org
@ 2009-01-24 10:25 ` rguenth at gcc dot gnu dot org
  2009-04-16 15:43 ` pinskia at gcc dot gnu dot org
  2009-06-04 11:35 ` rguenth at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-01-24 10:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from rguenth at gcc dot gnu dot org  2009-01-24 10:20 -------
GCC 4.3.3 is being released, adjusting target milestone.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.3.3                       |4.3.4


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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/36695] [4.3 Regression] Value-initialization of reference type is allowed.
  2008-07-02 12:52 [Bug c++/36695] New: [4.4 Regression] Value-initialization of reference type is allowed chris dot fairles at gmail dot com
                   ` (9 preceding siblings ...)
  2009-01-24 10:25 ` rguenth at gcc dot gnu dot org
@ 2009-04-16 15:43 ` pinskia at gcc dot gnu dot org
  2009-06-04 11:35 ` rguenth at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-04-16 15:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from pinskia at gcc dot gnu dot org  2009-04-16 15:43 -------
I am no longer working on this one.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|pinskia at gcc dot gnu dot  |unassigned at gcc dot gnu
                   |org                         |dot org
             Status|ASSIGNED                    |NEW


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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/36695] [4.3 Regression] Value-initialization of reference type is allowed.
  2008-07-02 12:52 [Bug c++/36695] New: [4.4 Regression] Value-initialization of reference type is allowed chris dot fairles at gmail dot com
                   ` (10 preceding siblings ...)
  2009-04-16 15:43 ` pinskia at gcc dot gnu dot org
@ 2009-06-04 11:35 ` rguenth at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-06-04 11:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from rguenth at gcc dot gnu dot org  2009-06-04 11:35 -------
Not worth fixing on the 4.3 branch.  Fixed for 4.4.0.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|4.3.4                       |4.4.0


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


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2009-06-04 11:35 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-02 12:52 [Bug c++/36695] New: [4.4 Regression] Value-initialization of reference type is allowed chris dot fairles at gmail dot com
2008-07-04 21:55 ` [Bug c++/36695] " jsm28 at gcc dot gnu dot org
2008-12-27 22:29 ` [Bug c++/36695] [4.3/4.4 Regression] " pinskia at gcc dot gnu dot org
2008-12-28  6:49 ` pinskia at gcc dot gnu dot org
2008-12-29 21:55 ` rguenth at gcc dot gnu dot org
2008-12-30  3:28 ` pinskia at gcc dot gnu dot org
2008-12-30  9:52 ` jakub at gcc dot gnu dot org
2008-12-31  1:42 ` pinskia at gcc dot gnu dot org
2009-01-10 11:48 ` jakub at gcc dot gnu dot org
2009-01-10 11:51 ` [Bug c++/36695] [4.3 " jakub at gcc dot gnu dot org
2009-01-24 10:25 ` rguenth at gcc dot gnu dot org
2009-04-16 15:43 ` pinskia at gcc dot gnu dot org
2009-06-04 11:35 ` rguenth at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).