This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix g++.dg/cpp2a/lambda-this3.C (Re: PATCH to enable testing C++17 by default)


On Tue, Oct 23, 2018 at 10:52:02AM +0200, Jakub Jelinek wrote:
> On Wed, Oct 17, 2018 at 03:31:43PM -0400, Marek Polacek wrote:
> > As discussed in <https://gcc.gnu.org/ml/gcc-patches/2018-10/msg00752.html> it
> > seems to be a high time we turned on testing C++17 by default.
> > 
> > The only interesting part is at the very end, otherwise most of the changes is
> > just using { target c++17 } instead of explicit dg-options.  Removing
> > dg-options has the effect that DEFAULT_CXXFLAGS comes in play, so I've removed
> > a bunch of stray semicolons to fix -Wpedantic errors.
> > 
> > I wonder if we also want to enable 2a, but the overhead could be too much.  Or
> > use 2a instead of 17?
> > 
> > Bootstrapped/regtested on x86_64-linux, ok for trunk?
> > 
> > 2018-10-17  Marek Polacek  <polacek@redhat.com>
> > 
> > 	* g++.dg/*.C: Use target c++17 instead of explicit dg-options.
> > 	* lib/g++-dg.exp: Don't test C++11 by default.  Add C++17 to
> > 	the list of default stds to test.
> 
> > diff --git gcc/testsuite/g++.dg/cpp2a/lambda-this3.C gcc/testsuite/g++.dg/cpp2a/lambda-this3.C
> > index 5e5c8b3d50f..d1738ea7d17 100644
> > --- gcc/testsuite/g++.dg/cpp2a/lambda-this3.C
> > +++ gcc/testsuite/g++.dg/cpp2a/lambda-this3.C
> > @@ -1,6 +1,6 @@
> >  // P0806R2
> > -// { dg-do compile }
> > -// { dg-options "-std=c++17" }
> > +// { dg-do compile { target c++17 } }
> > +// { dg-options "" }
> >  
> >  struct X {
> >    int x;
> 
> This test now fails with -std=gnu++2a:
> /.../gcc/gcc/testsuite/g++.dg/cpp2a/lambda-this3.C: In lambda function:
> /.../gcc/gcc/testsuite/g++.dg/cpp2a/lambda-this3.C:8:15: warning: implicit capture of 'this' via '[=]' is deprecated in C++20 [-Wdeprecated]
> /.../gcc/gcc/testsuite/g++.dg/cpp2a/lambda-this3.C:8:15: note: add explicit 'this' or '*this' capture
> /.../gcc/gcc/testsuite/g++.dg/cpp2a/lambda-this3.C: In lambda function:
> /.../gcc/gcc/testsuite/g++.dg/cpp2a/lambda-this3.C:16:15: warning: implicit capture of 'this' via '[=]' is deprecated in C++20 [-Wdeprecated]
> /.../gcc/gcc/testsuite/g++.dg/cpp2a/lambda-this3.C:16:15: note: add explicit 'this' or '*this' capture
> /.../gcc/gcc/testsuite/g++.dg/cpp2a/lambda-this3.C:17:16: warning: implicit capture of 'this' via '[=]' is deprecated in C++20 [-Wdeprecated]
> /.../gcc/gcc/testsuite/g++.dg/cpp2a/lambda-this3.C:17:16: note: add explicit 'this' or '*this' capture
> /.../gcc/gcc/testsuite/g++.dg/cpp2a/lambda-this3.C:18:13: warning: implicit capture of 'this' via '[=]' is deprecated in C++20 [-Wdeprecated]
> /.../gcc/gcc/testsuite/g++.dg/cpp2a/lambda-this3.C:18:13: note: add explicit 'this' or '*this' capture
> FAIL: g++.dg/cpp2a/lambda-this3.C  -std=gnu++2a  (test for bogus messages, line 8)
> FAIL: g++.dg/cpp2a/lambda-this3.C  -std=gnu++2a  (test for bogus messages, line 16)
> FAIL: g++.dg/cpp2a/lambda-this3.C  -std=gnu++2a  (test for bogus messages, line 17)
> FAIL: g++.dg/cpp2a/lambda-this3.C  -std=gnu++2a  (test for bogus messages, line 18)
> PASS: g++.dg/cpp2a/lambda-this3.C  -std=gnu++2a (test for excess errors)
> 
> The following patch fixes this, tested on x86_64-linux with
> make check-c++-all RUNTESTFLAGS=dg.exp=lambda-this3.C
> Ok for trunk?

Oops, sorry, I thought I'd limited the test to c++17_only.  I don't know why
it wasn't part of the patch.

Marek


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]