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++/51480] New: non-const default argument gets rejected


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

             Bug #: 51480
           Summary: non-const default argument gets rejected
    Classification: Unclassified
           Product: gcc
           Version: 4.5.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: thomas@maier-komor.de


non-const default arguments get rejected with following error message:
error: default argument for 'A& a' has type 'A'

Here is an example, where function rejected causes an error, while function
accepted is accepted.

struct A
{
};

void accepted(const A &a = A())
{
}

void rejected(A &a = A())
{
}


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