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

question


Is there an "undefined behaviour" in the following short code?


//
# include <iostream>
# include <functional>

 int main(  )
 {
  int c = 90;
  double r = 70;
  auto v = [c] (double c)
   {std::cout << "homonymous dummy argument ... " << c << std::endl;};
  v(r);
 }


//

I ask this because the gnu-gcc compiler prints out the value of the "captured" int c = 90 variable, while clang prints the value of the double r = 70 transmitted argument instead...


Thanks for your attention.

G. Servizi


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