From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11066 invoked by alias); 3 Apr 2003 22:10:37 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 11058 invoked from network); 3 Apr 2003 22:10:33 -0000 Received: from unknown (HELO i3s.net) (24.219.4.129) by sources.redhat.com with SMTP; 3 Apr 2003 22:10:33 -0000 Received: from Phobos (unverified [24.219.116.230]) by i3s.net (Rockliffe SMTPRA 4.5.4) with SMTP id for ; Thu, 3 Apr 2003 16:10:32 -0600 Message-ID: <000b01c2fa2d$d73bad80$0300a8c0@lemings.com> From: "Eric Lemings" To: Subject: Const in default function arguments? Date: Thu, 03 Apr 2003 22:10:00 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-SW-Source: 2003-04/txt/msg00021.txt.bz2 [elemings@cyberia c++]$ g++ --version g++ (GCC) 3.2.2 Copyright (C) 2002 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. [elemings@cyberia c++]$ more Test01.cpp #include struct Foo { int i; }; struct Bar: public Foo { // empty class body }; void G (const Foo& f = Bar ()) { std::cout << f.i << std::endl; } [elemings@cyberia c++]$ diff Test01.cpp Test02.cpp 12c12 < void G (const Foo& f = Bar ()) { --- > void G (Foo& f = Bar ()) { [elemings@cyberia c++]$ g++ -g -Wall -pedantic -c Test01.cpp [elemings@cyberia c++]$ g++ -g -Wall -pedantic -c Test02.cpp Test02.cpp:12: default argument for `Foo&f' has type `Bar' Why won't the non-const version compile?