This is the mail archive of the gcc@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]

Deprecate default-argument-on-function-type extension?


G++ has an undocumented extension that allows you to say something
like:

  void f(int);

  void g() {
    typedef void (*P)(int = 3);
    P p = f;
    (*p)();
  }

This is cute, but it doesn't provide any major expressive power, and
it definitely muddies the type system.  (Mostly, we consider ignore
the default arguments when thinking about the type, but I wouldn't be
surprised if we get things wrong in duplicate_decls if you have two
function declarations where a parameter to each function is itself a
function pointer with default arguments...)

I'd like to just drop this in the new parser, and, therefore,
deprecate it in the next major release.

Does anyone think we need to keep this?

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com


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