public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/17634] New: default arguments not permitted in typedef's
@ 2004-09-23 13:55 papadopo at shfj dot cea dot fr
  2004-09-23 14:02 ` [Bug c++/17634] " pinskia at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: papadopo at shfj dot cea dot fr @ 2004-09-23 13:55 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/17634] default arguments not permitted in typedef's
  2004-09-23 13:55 [Bug c++/17634] New: default arguments not permitted in typedef's papadopo at shfj dot cea dot fr
@ 2004-09-23 14:02 ` pinskia at gcc dot gnu dot org
  2004-09-23 14:14 ` schwab at suse dot de
  2004-09-23 14:55 ` papadopo at shfj dot cea dot fr
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-23 14:02 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-09-23 14:02 -------
Now on the mainline, the second example is rejected also : Search converges between 2004-06-22-
trunk (#470) and 2004-06-24-trunk (#471).

For the first example: Search converges between 2002-12-14-trunk (#159) and 2002-12-29-trunk 
(#160).  This would be when the new C++ parser came in.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17634


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/17634] default arguments not permitted in typedef's
  2004-09-23 13:55 [Bug c++/17634] New: default arguments not permitted in typedef's papadopo at shfj dot cea dot fr
  2004-09-23 14:02 ` [Bug c++/17634] " pinskia at gcc dot gnu dot org
@ 2004-09-23 14:14 ` schwab at suse dot de
  2004-09-23 14:55 ` papadopo at shfj dot cea dot fr
  2 siblings, 0 replies; 4+ messages in thread
From: schwab at suse dot de @ 2004-09-23 14:14 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From schwab at suse dot de  2004-09-23 14:12 -------
Default arguments are not permitted in typedefs [dcl.fct.default]: 
 
3 A default argument expression shall be specified only in the 
parameter-declaration-clause of a function declaration or in a 
template-parameter (14.1). If it is specified in a 
parameter-declaration-clause, it shall not occur within a declarator or 
abstract-declarator of a parameter-declaration. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17634


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/17634] default arguments not permitted in typedef's
  2004-09-23 13:55 [Bug c++/17634] New: default arguments not permitted in typedef's papadopo at shfj dot cea dot fr
  2004-09-23 14:02 ` [Bug c++/17634] " pinskia at gcc dot gnu dot org
  2004-09-23 14:14 ` schwab at suse dot de
@ 2004-09-23 14:55 ` papadopo at shfj dot cea dot fr
  2 siblings, 0 replies; 4+ messages in thread
From: papadopo at shfj dot cea dot fr @ 2004-09-23 14:55 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From papadopo at shfj dot cea dot fr  2004-09-23 14:55 -------
OK, this is not legal C++, but there's still a bug - the missing error message
in the second case.

>From what I can understand it won't be fixed in gcc 3.4, will it?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17634


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-09-23 14:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-23 13:55 [Bug c++/17634] New: default arguments not permitted in typedef's papadopo at shfj dot cea dot fr
2004-09-23 14:02 ` [Bug c++/17634] " pinskia at gcc dot gnu dot org
2004-09-23 14:14 ` schwab at suse dot de
2004-09-23 14:55 ` papadopo at shfj dot cea dot fr

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).