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

[C++14/lambda] Experimental polymorphic lambda patches

Hi all,

I've finally reworked the generic lambda patches I made back in 2009
to apply against GCC's mainline.

The syntaxes demonstrated by the following examples are supported (as
per the previous incarnation) implementing parts of N3559 and N3560.

  1.  [] (auto x, auto& y, auto const& z) { return x + y + z; } 
  2.  [] <typename X, typename Y, typename Z> (X x, Y& y, Z const& z) { return x + y + z; } 
  3.  [] <typename Y> (auto x, Y& y, auto const& z) { return x + y + z; } 

Missing features:

 - Conversion to function pointer of stateless generic lambdas is
   currently unsupported.  Currently a warning is generated for all
   such lambdas at their definition.

Other issues: (see XXX, FIXME, TODO)

  a)  Location of implementation.
  b)  What to do about name mangling?
  c)  Figure out why symtab contains nullptrs.  Maybe related to (b).
  d)  Not behind any -std option.  Should require -std=c++1y or
  e)  Should collect 'auto' parameters during parse and realloc
      template parameter list once at the end of the parameter list
      rather than incrementally.

Any comments appreciated.  Guidance on implementing the conversion
operator for stateless generic lambdas would be useful.  I've made a
few attempts which were lacking!


Patch summary: (4):
  [lambda] [polymorphic] Support template-parameter-list in
  [lambda] [polymorphic] Support generic lambdas in templates.
  [lambda] [polymorphic] Infer template parameter from auto used in
    function parameter list.
  [lambda] [polymorphic] [HACK] Avoid crash on symbol table writing when
    generic lambda declared with iostream (or potentially other code)

 gcc/cp/decl.c      |   1 +
 gcc/cp/mangle.c    |   2 +
 gcc/cp/parser.c    | 246 +++++++++++++++++++++++++++++++++++++++++++++++++++--
 gcc/cp/pt.c        |  10 +++
 gcc/cp/semantics.c |  10 ++-
 gcc/symtab.c       |  18 ++++
 6 files changed, 279 insertions(+), 8 deletions(-)


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