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; 10+ 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] 10+ messages in thread

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

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-21353-10556@http.gcc.gnu.org/bugzilla/>
2005-10-14 16:46 ` [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 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 ` nathan at gcc dot gnu dot org
2005-10-17 11:26 ` cvs-commit at gcc dot gnu dot org
2005-05-03  8:50 [Bug c++/21353] New: " 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

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).