public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/10608: default arguments not permitted, function typedef
@ 2003-05-03 7:48 giovannibajo
0 siblings, 0 replies; 2+ messages in thread
From: giovannibajo @ 2003-05-03 7:48 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, nelsonbe, nobody
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 518 bytes --]
Synopsis: default arguments not permitted, function typedef
State-Changed-From-To: open->closed
State-Changed-By: bajo
State-Changed-When: Sat May 3 07:48:47 2003
State-Changed-Why:
Not a bug. §8.3.6p3 explicitally rejects default arguments
in typedefs. Before 3.4, we had an accept-illegal on this,
now it's finally fixed.
The -pedantic issue is a well known bug, for which we
already have a PR (c++/10032).
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10608
^ permalink raw reply [flat|nested] 2+ messages in thread
* c++/10608: default arguments not permitted, function typedef
@ 2003-05-03 2:46 nelsonbe
0 siblings, 0 replies; 2+ messages in thread
From: nelsonbe @ 2003-05-03 2:46 UTC (permalink / raw)
To: gcc-gnats
>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:
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-05-03 7:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-03 7:48 c++/10608: default arguments not permitted, function typedef giovannibajo
-- strict thread matches above, loose matches on Subject: below --
2003-05-03 2:46 nelsonbe
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).