This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/61381] New: constexpr non captured by template lambda
- From: "vincenzo.innocente at cern dot ch" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 01 Jun 2014 14:54:31 +0000
- Subject: [Bug c++/61381] New: constexpr non captured by template lambda
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61381
Bug ID: 61381
Summary: constexpr non captured by template lambda
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: vincenzo.innocente at cern dot ch
cat ceLambda.cc
struct Bar { constexpr Bar(float i):f(i){}; float f;};
float foo1(float x) {
constexpr Bar z{0};
auto f = [=](auto a, auto b) -> Bar { return z;};
return f(x,x).f;
}
float foo2(float x) {
const Bar z{0};
auto f = [=](auto a, auto b) -> Bar { return z;};
return f(x,x).f;
}
float foo3(float x) {
constexpr Bar z{0};
auto f = [=](float a, float b) -> Bar { return z;};
return f(x,x).f;
}
b-d-128-141-131-42:ctest innocent$ c++ -O2 -std=c++1y -S ceLambda.cc
ceLambda.cc: In instantiation of âfoo1(float)::<lambda(auto:1, auto:2)> [with
auto:1 = float; auto:2 = float]â:
ceLambda.cc:7:16: required from here
ceLambda.cc:5:49: error: âzâ was not declared in this scope
auto f = [=](auto a, auto b) -> Bar { return z;};
^