This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/17634] New: default arguments not permitted in typedef's


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]