public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/21353] New: rvalues should not be allowed to be default values for non const references in class functions.
@ 2005-05-03  8:50 s_siddharth_reddy at yahoo dot com
  2005-05-03 15:04 ` [Bug c++/21353] [3.4/4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: s_siddharth_reddy at yahoo dot com @ 2005-05-03  8:50 UTC (permalink / raw)
  To: gcc-bugs

works as expected on : gcc 2.95, freebsd/linux
does not work as expected on: gcc 3.4.2, freebsd/linux

//non-const references to temp values should be disallowed
--------------
//the code
enum X{ a, b, c };
class C
{
public:
       void func( X & ref = a ) //illegal - should not compile.
       { }
};
int main( )
{ }

//compile with gcc 2.95
$g++ test2.cpp
test2.cpp:7: invalid type `X' for default argument to `X &'

//compile with gcc 3.4.2
$g++3 test2.cpp
$ 
----------------

this problem does not exist for functions in global scope.

-- 
           Summary: rvalues should not be allowed to be default values for
                    non const references in class functions.
           Product: gcc
           Version: 3.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: s_siddharth_reddy at yahoo dot com
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c++/21353] [3.4/4.0/4.1 Regression] rvalues should not be allowed to be default values for non const references in class functions.
  2005-05-03  8:50 [Bug c++/21353] New: rvalues should not be allowed to be default values for non const references in class functions s_siddharth_reddy at yahoo dot com
@ 2005-05-03 15:04 ` pinskia at gcc dot gnu dot org
  2005-05-19 17:41 ` mmitchel at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-03 15:04 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-03 15:04 -------
The problem is that we are checking too late.

Confirmed, a regression from 3.3.3.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |accepts-invalid
      Known to fail|                            |4.0.0 4.1.0 3.4.0
      Known to work|                            |3.3.3
   Last reconfirmed|0000-00-00 00:00:00         |2005-05-03 15:04:22
               date|                            |
            Summary|rvalues should not be       |[3.4/4.0/4.1 Regression]
                   |allowed to be default values|rvalues should not be
                   |for non const references in |allowed to be default values
                   |class functions.            |for non const references in
                   |                            |class functions.
   Target Milestone|---                         |3.4.4


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


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

* [Bug c++/21353] [3.4/4.0/4.1 Regression] rvalues should not be allowed to be default values for non const references in class functions.
  2005-05-03  8:50 [Bug c++/21353] New: rvalues should not be allowed to be default values for non const references in class functions s_siddharth_reddy at yahoo dot com
  2005-05-03 15:04 ` [Bug c++/21353] [3.4/4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
@ 2005-05-19 17:41 ` mmitchel at gcc dot gnu dot org
  2005-07-12  5:53 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-05-19 17:41 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|3.4.4                       |3.4.5


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


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

* [Bug c++/21353] [3.4/4.0/4.1 Regression] rvalues should not be allowed to be default values for non const references in class functions.
  2005-05-03  8:50 [Bug c++/21353] New: rvalues should not be allowed to be default values for non const references in class functions s_siddharth_reddy at yahoo dot com
  2005-05-03 15:04 ` [Bug c++/21353] [3.4/4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
  2005-05-19 17:41 ` mmitchel at gcc dot gnu dot org
@ 2005-07-12  5:53 ` pinskia at gcc dot gnu dot org
  2005-07-22 21:18 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-12  5:53 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-12 05:51 -------
Reduced testcase:
enum X{ a, b, c };
class C
{
  void func( X & ref = a );
};

This has been failing since "3.4.0 20040116" (which is the branch date for 3.4.0).

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2005-05-03 15:04:22         |2005-07-12 05:51:48
               date|                            |


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


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

* [Bug c++/21353] [3.4/4.0/4.1 Regression] rvalues should not be allowed to be default values for non const references in class functions.
  2005-05-03  8:50 [Bug c++/21353] New: rvalues should not be allowed to be default values for non const references in class functions s_siddharth_reddy at yahoo dot com
                   ` (2 preceding siblings ...)
  2005-07-12  5:53 ` pinskia at gcc dot gnu dot org
@ 2005-07-22 21:18 ` pinskia at gcc dot gnu dot org
  2005-09-12 20:50 ` pinskia at gcc dot gnu dot org
  2005-09-27 16:19 ` mmitchel at gcc dot gnu dot org
  5 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-22 21:18 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-22 21:12 -------
Moving to 4.0.2 pre Mark.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|3.4.5                       |4.0.2


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


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

* [Bug c++/21353] [3.4/4.0/4.1 Regression] rvalues should not be allowed to be default values for non const references in class functions.
  2005-05-03  8:50 [Bug c++/21353] New: rvalues should not be allowed to be default values for non const references in class functions s_siddharth_reddy at yahoo dot com
                   ` (3 preceding siblings ...)
  2005-07-22 21:18 ` pinskia at gcc dot gnu dot org
@ 2005-09-12 20:50 ` pinskia at gcc dot gnu dot org
  2005-09-27 16:19 ` mmitchel at gcc dot gnu dot org
  5 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-12 20:50 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-09-12 20:50 -------
: Search converges between 2002-12-14-trunk (#159) and 2002-12-29-trunk (#160).


-- 


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


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

* [Bug c++/21353] [3.4/4.0/4.1 Regression] rvalues should not be allowed to be default values for non const references in class functions.
  2005-05-03  8:50 [Bug c++/21353] New: rvalues should not be allowed to be default values for non const references in class functions s_siddharth_reddy at yahoo dot com
                   ` (4 preceding siblings ...)
  2005-09-12 20:50 ` pinskia at gcc dot gnu dot org
@ 2005-09-27 16:19 ` mmitchel at gcc dot gnu dot org
  5 siblings, 0 replies; 11+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-09-27 16:19 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.0.2                       |4.0.3


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


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

* [Bug c++/21353] [3.4/4.0/4.1 Regression] rvalues should not be allowed to be default values for non const references in class functions.
       [not found] <bug-21353-10556@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2005-10-17 11:26 ` cvs-commit at gcc dot gnu dot org
@ 2005-10-17 11:26 ` nathan at gcc dot gnu dot org
  3 siblings, 0 replies; 11+ messages in thread
From: nathan at gcc dot gnu dot org @ 2005-10-17 11:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from nathan at gcc dot gnu dot org  2005-10-17 11:26 -------
fixed mainline and 4.0.
2005-10-17  Nathan Sidwell  <nathan@codesourcery.com>

        PR c++/21353
        * decl.c (check_default_argument): Don't check
        processing_template_decl or uses_template_parms here.
        (grokparms): Only call check_default_argument when not processing
        a template decl.
        * parser.c (cp_parser_late_parsing_default_arg): Call
        check_default_argument when not processing a template decl.

wont fix 3.4


-- 

nathan at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


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

* [Bug c++/21353] [3.4/4.0/4.1 Regression] rvalues should not be allowed to be default values for non const references in class functions.
       [not found] <bug-21353-10556@http.gcc.gnu.org/bugzilla/>
  2005-10-14 16:46 ` nathan at gcc dot gnu dot org
  2005-10-17 11:19 ` cvs-commit at gcc dot gnu dot org
@ 2005-10-17 11:26 ` cvs-commit at gcc dot gnu dot org
  2005-10-17 11:26 ` nathan at gcc dot gnu dot org
  3 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-10-17 11:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from cvs-commit at gcc dot gnu dot org  2005-10-17 11:26 -------
Subject: Bug 21353

CVSROOT:        /cvs/gcc
Module name:    gcc
Branch:         gcc-4_0-branch
Changes by:     nathan@gcc.gnu.org      2005-10-17 11:26:51

Modified files:
        gcc/cp         : ChangeLog decl.c parser.c 
        gcc/testsuite  : ChangeLog 
Added files:
        gcc/testsuite/g++.dg/template: defarg6.C 

Log message:
        cp:
        PR c++/21353
        * decl.c (check_default_argument): Don't check
        processing_template_decl or uses_template_parms here.
        (grokparms): Only call check_default_argument when not processing
        a template decl.
        * parser.c (cp_parser_late_parsing_default_arg): Call
        check_default_argument when not processing a template decl.
        testsuite:
        PR c++/21353
        * g++.dg/template/defarg6.C: New.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.4648.2.138&r2=1.4648.2.139
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.1371.2.28&r2=1.1371.2.29
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.319.2.23&r2=1.319.2.24
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5084.2.461&r2=1.5084.2.462
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/defarg6.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1


-- 


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


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

* [Bug c++/21353] [3.4/4.0/4.1 Regression] rvalues should not be allowed to be default values for non const references in class functions.
       [not found] <bug-21353-10556@http.gcc.gnu.org/bugzilla/>
  2005-10-14 16:46 ` nathan at gcc dot gnu dot org
@ 2005-10-17 11:19 ` cvs-commit at gcc dot gnu dot org
  2005-10-17 11:26 ` cvs-commit at gcc dot gnu dot org
  2005-10-17 11:26 ` nathan at gcc dot gnu dot org
  3 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-10-17 11:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from cvs-commit at gcc dot gnu dot org  2005-10-17 11:19 -------
Subject: Bug 21353

CVSROOT:        /cvs/gcc
Module name:    gcc
Changes by:     nathan@gcc.gnu.org      2005-10-17 11:19:12

Modified files:
        gcc/cp         : ChangeLog decl.c parser.c 
        gcc/testsuite  : ChangeLog 
Added files:
        gcc/testsuite/g++.dg/template: defarg6.C 

Log message:
        cp:
        PR c++/21353
        * g++.dg/template/defarg6.C: New.
        testsuite:
        PR c++/21353
        * decl.c (check_default_argument): Don't check
        processing_template_decl or uses_template_parms here.
        (grokparms): Only call check_default_argument when not processing
        a template decl.
        * parser.c (cp_parser_late_parsing_default_arg): Call
        check_default_argument when not processing a template decl.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4940&r2=1.4941
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.1436&r2=1.1437
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&r1=1.365&r2=1.366
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.6202&r2=1.6203
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/defarg6.C.diff?cvsroot=gcc&r1=NONE&r2=1.1


-- 


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


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

* [Bug c++/21353] [3.4/4.0/4.1 Regression] rvalues should not be allowed to be default values for non const references in class functions.
       [not found] <bug-21353-10556@http.gcc.gnu.org/bugzilla/>
@ 2005-10-14 16:46 ` nathan at gcc dot gnu dot org
  2005-10-17 11:19 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: nathan at gcc dot gnu dot org @ 2005-10-14 16:46 UTC (permalink / raw)
  To: gcc-bugs



-- 

nathan at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |nathan at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2005-09-10 02:51:58         |2005-10-14 16:46:31
               date|                            |


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


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

end of thread, other threads:[~2005-10-17 11:26 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-03  8:50 [Bug c++/21353] New: rvalues should not be allowed to be default values for non const references in class functions s_siddharth_reddy at yahoo dot com
2005-05-03 15:04 ` [Bug c++/21353] [3.4/4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
2005-05-19 17:41 ` mmitchel at gcc dot gnu dot org
2005-07-12  5:53 ` pinskia at gcc dot gnu dot org
2005-07-22 21:18 ` pinskia at gcc dot gnu dot org
2005-09-12 20:50 ` pinskia at gcc dot gnu dot org
2005-09-27 16:19 ` mmitchel at gcc dot gnu dot org
     [not found] <bug-21353-10556@http.gcc.gnu.org/bugzilla/>
2005-10-14 16:46 ` nathan at gcc dot gnu dot org
2005-10-17 11:19 ` cvs-commit at gcc dot gnu dot org
2005-10-17 11:26 ` cvs-commit at gcc dot gnu dot org
2005-10-17 11:26 ` nathan 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).