public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: nelsonbe@earthlink.net To: gcc-gnats@gcc.gnu.org Subject: c++/10608: default arguments not permitted, function typedef Date: Sat, 03 May 2003 02:46:00 -0000 [thread overview] Message-ID: <20030503024526.19047.qmail@sources.redhat.com> (raw) >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 <iostream> 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:
next reply other threads:[~2003-05-03 2:46 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2003-05-03 2:46 nelsonbe [this message] 2003-05-03 7:48 giovannibajo
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20030503024526.19047.qmail@sources.redhat.com \ --to=nelsonbe@earthlink.net \ --cc=gcc-gnats@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).