Mercurial > hg > CbC > CbC_gcc
diff gcc/testsuite/g++.dg/cpp1z/lambda-this1.C @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children |
line wrap: on
line diff
--- a/gcc/testsuite/g++.dg/cpp1z/lambda-this1.C Fri Oct 27 22:46:09 2017 +0900 +++ b/gcc/testsuite/g++.dg/cpp1z/lambda-this1.C Thu Oct 25 07:37:49 2018 +0900 @@ -15,7 +15,7 @@ auto g = [*this] { a++; }; // { dg-error "in read-only object" } // { dg-error "'*this' capture only available with" "" { target c++14_down } .-1 } auto h = [*this] () mutable { a++; };// { dg-error "'*this' capture only available with" "" { target c++14_down } } - auto i = [=] { return a; }; + auto i = [=] { return a; }; // { dg-warning "implicit capture" "" { target c++2a } } auto j = [&] { return a; }; // P0409R2 - C++2A lambda capture [=, this] auto k = [=, this] { return a; };// { dg-error "explicit by-copy capture of 'this' redundant with by-copy capture default" "" { target c++17_down } } @@ -50,7 +50,7 @@ double foo () { return [this]{ return [*this] { return b; }; }()(); // { dg-error "'*this' capture only available with" "" { target c++14_down } } } - double bar () { + void bar () { auto c = []{ return [*this] { return b; }; }; // { dg-error "'this' was not captured for this lambda function" } } // { dg-error "invalid use of non-static data member 'B::b'" "" { target *-*-* } .-1 } }; // { dg-error "'*this' capture only available with" "" { target c++14_down } .-2 } @@ -62,7 +62,7 @@ auto d = [this] { return c; }; auto e = [*this] { return c; }; // { dg-error "use of deleted function" } // { dg-error "'*this' capture only available with" "" { target c++14_down } .-1 } - auto f = [=] { return c; }; + auto f = [=] { return c; }; // { dg-warning "implicit capture" "" { target c++2a } } auto g = [&] { return c; }; auto h = [this] { bar (); }; auto i = [*this] { bar (); }; // { dg-error "use of deleted function" } @@ -77,7 +77,7 @@ auto e = [this] { return d; }; auto f = [*this] { return d; }; // { dg-error "use of deleted function" } // { dg-error "'*this' capture only available with" "" { target c++14_down } .-1 } - auto g = [=] { return d; }; + auto g = [=] { return d; }; // { dg-warning "implicit capture" "" { target c++2a } } auto h = [&] { return d; }; auto i = [this] { bar (); }; auto j = [*this] { bar (); }; // { dg-error "use of deleted function" }