From 13380861fc01c252a4306ccc650120f6020b00b7 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Wed, 13 Sep 2017 17:28:37 +0000 Subject: [PATCH] re PR c++/61135 (It seems to be not able to call virtual method of literal object in lambda expression) 2017-09-13 Paolo Carlini PR c++/61135 * g++.dg/cpp0x/lambda/lambda-ice18.C: New. * g++.dg/cpp1y/lambda-ice2.C: Likewise. From-SVN: r252571 --- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice18.C | 15 +++++++++++++++ gcc/testsuite/g++.dg/cpp1y/lambda-ice2.C | 21 +++++++++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice18.C create mode 100644 gcc/testsuite/g++.dg/cpp1y/lambda-ice2.C diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 86d030de2d9..e739feafd3a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2017-09-13 Paolo Carlini + + PR c++/61135 + * g++.dg/cpp0x/lambda/lambda-ice18.C: New. + * g++.dg/cpp1y/lambda-ice2.C: Likewise. + 2017-09-13 Jackson Woodruff * gcc.target/aarch64/simd/vect_str_zero.c: Update testcase. diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice18.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice18.C new file mode 100644 index 00000000000..83e8ae049d8 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice18.C @@ -0,0 +1,15 @@ +// PR c++/61135 +// { dg-do compile { target c++11 } } + +struct Base +{ + virtual int b() const{return 1;}; +}; + +struct Super:Base{}; + +int main() +{ + constexpr Super s = Super(); + [&]{s.b();}(); +} diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-ice2.C b/gcc/testsuite/g++.dg/cpp1y/lambda-ice2.C new file mode 100644 index 00000000000..8539de11ed6 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/lambda-ice2.C @@ -0,0 +1,21 @@ +// PR c++/61135 +// { dg-do compile { target c++14 } } + +struct A +{ + int funcA(){return 0;} +}; + +template +struct B:virtual public A{ + void funcB(){ + [a=this->funcA()]{}; + } +}; + +int main() +{ + B b; + b.funcB(); + return 0; +} -- 2.11.4.GIT