From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19398 invoked by alias); 3 May 2003 02:46:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 19378 invoked by uid 71); 3 May 2003 02:46:01 -0000 Resent-Date: 3 May 2003 02:46:01 -0000 Resent-Message-ID: <20030503024601.19377.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, nelsonbe@earthlink.net Received: (qmail 19048 invoked by uid 48); 3 May 2003 02:45:26 -0000 Message-Id: <20030503024526.19047.qmail@sources.redhat.com> Date: Sat, 03 May 2003 02:46:00 -0000 From: nelsonbe@earthlink.net Reply-To: nelsonbe@earthlink.net To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c++/10608: default arguments not permitted, function typedef X-SW-Source: 2003-05/txt/msg00191.txt.bz2 List-Id: >Number: 10608 >Category: c++ >Synopsis: default arguments not permitted, function typedef >Confidential: no >Severity: non-critical >Priority: medium >Responsible: unassigned >State: open >Class: rejects-legal >Submitter-Id: net >Arrival-Date: Sat May 03 02:46:01 UTC 2003 >Closed-Date: >Last-Modified: >Originator: 3.4 20030502 (experimental) >Release: unknown-1.0 >Organization: >Environment: GNU/Linux (Red Hat 7.3) >Description: ------------------- default_args.cc ----------------------- #include int func(int val1, int val2 = 0) { return val1 + val2; } int main() { typedef int (*fptr)(int, int = 0); fptr fp = func; std::cout << fp(42) << '\n'; std::cout << fp(42, 1) << '\n'; } >How-To-Repeat: - With g++ version 3.4 20030502 (experimental), compile as follows: g++ default-args-func.cc * This yields the following error diagnostic: error: default arguments are only permitted on functions >Fix: Using the same version of the compiler, the error is reduced to a warning when compiling the cited code as follows (adding -ansi and pedantic): g++ -ansi -pedantic default-args-func.cc >Release-Note: >Audit-Trail: >Unformatted: