mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-23 14:01:03 +08:00
re PR c++/64085 (ICE on C++14 lambda by-reference capture with an initializer)
/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
This commit is contained in:
parent
1dc15b0b9d
commit
a3d94329e9
gcc
@ -1,3 +1,9 @@
|
||||
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
|
||||
|
@ -506,7 +506,7 @@ add_capture (tree lambda, tree id, tree orig_init, bool by_reference_p,
|
||||
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
|
||||
|
@ -1,3 +1,8 @@
|
||||
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.
|
||||
|
18
gcc/testsuite/g++.dg/cpp1y/lambda-init13.C
Normal file
18
gcc/testsuite/g++.dg/cpp1y/lambda-init13.C
Normal file
@ -0,0 +1,18 @@
|
||||
// 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&>());
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user