* 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
+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>
PR c++/87770
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
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>
* gcc.dg/vect/pr84711.c: Use -Wno-psabi.
--- /dev/null
+// 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); };
+}