This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
question
- From: Graziano Servizi <Graziano dot Servizi at bo dot infn dot it>
- To: gcc-help at gcc dot gnu dot org
- Date: Mon, 21 Jul 2014 10:51:13 +0200
- Subject: question
- Authentication-results: sourceware.org; auth=none
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