This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/17634] New: default arguments not permitted in typedef's
- From: "papadopo at shfj dot cea dot fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 23 Sep 2004 13:55:21 -0000
- Subject: [Bug c++/17634] New: default arguments not permitted in typedef's
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following used to compile in gcc 3.3:
$ cat foo.cc
typedef void (*Function)(int n = 1);
$ g++ -c foo.cc
$
It doesn't compile anymore in gcc 3.4:
$ cat foo.cc
typedef void (*Function)(int n = 1);
$ g++ -c foo.cc
foo.cc:1: error:
default arguments are only permitted for function parameters
$
Although I'm not sure this is legal C++, I've opened a bug report because the
following does work with gcc 3.4, which seems inconsistent:
$ cat foo.cc
struct MyClass {
typedef void (MyClass::*Function)(int n = 1);
};
$ g++ -c foo.cc
$
--
Summary: default arguments not permitted in typedef's
Product: gcc
Version: 3.4.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: papadopo at shfj dot cea dot fr
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17634