Commit 0d806438 by Marek Polacek Committed by Marek Polacek

PR c++/89158 - by-value capture of constexpr variable broken.

	* call.c (convert_like_real) <case ck_user>: Call mark_exp_read
	instead of mark_rvalue_use.

	* g++.dg/cpp0x/lambda/lambda-89158.C: New test.

From-SVN: r268561
parent b81e1cd5
2019-02-05 Marek Polacek <polacek@redhat.com>
PR c++/89158 - by-value capture of constexpr variable broken.
* call.c (convert_like_real) <case ck_user>: Call mark_exp_read
instead of mark_rvalue_use.
2019-02-05 Alexandre Oliva <aoliva@redhat.com> 2019-02-05 Alexandre Oliva <aoliva@redhat.com>
PR c++/87770 PR c++/87770
......
...@@ -7006,7 +7006,9 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum, ...@@ -7006,7 +7006,9 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
return expr; return expr;
} }
expr = mark_rvalue_use (expr); /* We don't know here whether EXPR is being used as an lvalue or
rvalue, but we know it's read. */
mark_exp_read (expr);
/* Pass LOOKUP_NO_CONVERSION so rvalue/base handling knows not to allow /* Pass LOOKUP_NO_CONVERSION so rvalue/base handling knows not to allow
any more UDCs. */ any more UDCs. */
......
2019-02-05 Marek Polacek <polacek@redhat.com>
PR c++/89158 - by-value capture of constexpr variable broken.
* g++.dg/cpp0x/lambda/lambda-89158.C: New test.
2019-02-05 Segher Boessenkool <segher@kernel.crashing.org> 2019-02-05 Segher Boessenkool <segher@kernel.crashing.org>
* gcc.dg/vect/pr84711.c: Use -Wno-psabi. * gcc.dg/vect/pr84711.c: Use -Wno-psabi.
......
// PR c++/89158
// { dg-do compile { target c++11 } }
struct T { T(const int&); };
void Func(T);
void test()
{
constexpr int Val = 42;
[Val]() { Func(Val); };
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment