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++/54557] [c++ lambda] error in assigning lambda expr though "operator?:" while capturing


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

vincenzo Innocente <vincenzo.innocente at cern dot ch> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID
            Summary|[c++ lambda] error in       |[c++ lambda] error in
                   |assigning lambda expr       |assigning lambda expr
                   |though "operator?:" while   |though "operator?:" while
                   |catching                    |capturing

--- Comment #2 from vincenzo Innocente <vincenzo.innocente at cern dot ch> 2012-09-13 06:37:02 UTC ---
Understood.
Thanks for the detailed answer: I will read the standard more in detail.

Syntactic-wise It seems that I can implement it as

bool A::foo4(int i, int j) const {
  auto f1 = sel ? [](int a, int b,int) { return a<b;} :
                  [](int a, int b, int k) { return a<b+k;};

  auto f = [this,f1](int a, int b) { return f1(a,b,q);};
  return f(i,j);
}

As optimization is what I'm looking for
I will look to the generated assembler and then decide the specific
implementation.


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