This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/70735] New: problem combining std::function, generic lambdas and static variables
- From: "paolo.monteverde at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 20 Apr 2016 09:59:39 +0000
- Subject: [Bug c++/70735] New: problem combining std::function, generic lambdas and static variables
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70735
Bug ID: 70735
Summary: problem combining std::function, generic lambdas and
static variables
Product: gcc
Version: 5.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: paolo.monteverde at gmail dot com
Target Milestone: ---
The code
#include <iostream>
#include <functional>
int main()
{
static int a;
std::function<void(int)> f = [](auto) { std::cout << a << '\n'; };
a = 1;
f(0);
}
prints "0" instead of "1". Compiled with "g++ -std=c++14"; verified on Arch and
Ubuntu with GCC 5.3.0. Though, using coliru, it works well:
http://coliru.stacked-crooked.com/a/abff4a693ebcaf86
- Follow-Ups:
- [Bug c++/70735] [5/6/7 Regression] problem combining std::function, generic lambdas and static variables
- From: redi at gcc dot gnu.org
- [Bug c++/70735] [5/6/7 Regression] problem combining std::function, generic lambdas and static variables
- From: paolo.monteverde at gmail dot com
- [Bug c++/70735] [5/6/7 Regression] problem combining std::function, generic lambdas and static variables
- From: paolo.monteverde at gmail dot com
- [Bug c++/70735] [5/6/7 Regression] problem combining std::function, generic lambdas and static variables
- From: redi at gcc dot gnu.org
- [Bug c++/70735] [5/6/7 Regression] problem combining std::function, generic lambdas and static variables
- From: redi at gcc dot gnu.org
- [Bug c++/70735] [5/6/7 Regression] problem combining std::function, generic lambdas and static variables
- From: allan at archlinux dot org
- [Bug c++/70735] [5/6/7 Regression] problem combining std::function, generic lambdas and static variables
- From: redi at gcc dot gnu.org
- [Bug libstdc++/70735] [5/6/7 Regression] problem combining std::function, generic lambdas and static variables
- From: redi at gcc dot gnu.org
- [Bug c++/70735] [5/6/7 Regression] problem combining std::function, generic lambdas and static variables
- From: redi at gcc dot gnu.org
- [Bug c++/70735] [5/6/7 Regression] problem combining std::function, generic lambdas and static variables
- From: redi at gcc dot gnu.org
- [Bug c++/70735] [5/6/7 Regression] problem combining std::function, generic lambdas and static variables
- From: redi at gcc dot gnu.org