This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/79104] [DR 696] wrong semantics for odr-use of constant variable from lambda
- From: "jason at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 10 Feb 2017 18:48:22 +0000
- Subject: [Bug c++/79104] [DR 696] wrong semantics for odr-use of constant variable from lambda
- Auto-submitted: auto-generated
- References: <bug-79104-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79104
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P1 |P3
Status|ASSIGNED |NEW
Summary|[7 Regression] ambiguity |[DR 696] wrong semantics
|calling std::begin on a |for odr-use of constant
|local constexpr array of |variable from lambda
|structs |
--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> ---
The handling of this testcase went from wrong-code to rejects-valid, so I don't
think it qualifies as a regression. The issue here is that we don't implement
DR 696 properly; we should capture a, but instead replace it with its initial
value. Given that, r240819 changed this to be correctly rejected; a temporary
should not bind to a non-const reference.
Here's a simpler testcase to illustrate our non-conformance on DR 696:
void f ()
{
const int i = 42;
[&]() {
&i; // OK, captures i
};
}