/cp
2015-04-03 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/64085
* lambda.c (add_capture): Use dependent_type_p for capture by
reference too.
/testsuite
2015-04-03 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/64085
* g++.dg/cpp1y/lambda-init13.C: New.
From-SVN: r221858
+2015-04-03 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/64085
+ * lambda.c (add_capture): Use dependent_type_p for capture by
+ reference too.
+
2015-04-02 Marek Polacek <polacek@redhat.com>
PR c++/65642
if (by_reference_p)
{
type = build_reference_type (type);
- if (!real_lvalue_p (initializer))
+ if (!dependent_type_p (type) && !real_lvalue_p (initializer))
error ("cannot capture %qE by reference", initializer);
}
else
+2015-04-03 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/64085
+ * g++.dg/cpp1y/lambda-init13.C: New.
+
2015-04-03 Marek Polacek <polacek@redhat.com>
* g++.dg/cpp0x/pr57101.C: Use proper type for size_t.
--- /dev/null
+// PR c++/64085
+// { dg-do compile { target c++14 } }
+
+template<typename T>
+struct reference_wrapper
+{
+ T& get() const noexcept;
+};
+
+template<class T>
+auto make_monad(reference_wrapper<T> arg) {
+ return [&captive = arg.get()](auto&&) { return 1; };
+}
+
+int main()
+{
+ make_monad(reference_wrapper<int&>());
+}