On Tue, Aug 23, 2016 at 09:46:50AM +0200, Richard Biener wrote: > On Mon, Aug 22, 2016 at 11:54 PM, Pedro Alves <pal...@redhat.com> wrote: > > On 08/22/2016 10:26 PM, David Malcolm wrote: > > > >> it has no problems, whereas with the default for gcc 5 and earlier: > >> > >> $ gcc -c test.cc -std=gnu++98 > >> test.cc:3:15: warning: non-static data member initializers only > >> available with -std=c++11 or -std=gnu++11 > >> int field = 42; > >> ^~ > >> > >> So it's probably worth attempting to bootstrap with an older gcc as the > >> starting compiler. > > > > I believe that only stage 1 is built with -std=gnu++98 forced, and also > > stage 1 is built without -Werror, so I think you'd need to start with a > > compiler that predates support for that construct, not just one > > that predates the flip of the default. > > Uh, so we don't actually catch these errors during bootstrap with a too > recent host compiler? That's pretty bad. Ah, we add -pedantic if supported > but with now using C++ that only warns and does not error (the C FE errors) > so we actually need -pedantic-errors here.
ultimately there will always be some C++ things that newer compilers accept, but old ones don't. For example see PR 61679, where as far as I'm aware its just a bug in old versions and unrelated to C++ version. One thing I think we could do is add a -WC++98-compat warning, and pass -Werror=c++98-compat when supported if we run into these problems often enough. > So should we change config/warnings.m4:ACX_PROG_CXX_WARNING_ALMOST_PEDANTIC > to use -pedantic-errors? > > In the end conditionally allowing C++11 code in stage2+ was a mistake > if we can't catch > this kind of issues reliably. Well, I don't think we can ever catch all problems that may crop up on old toolchains reliably, though we should try and minimize it where possible. I'm not sure using C++11 for the final compiler is a mistake though, it allows safer, and perhaps more importantly faster code in some cases. We don't have too much use of it for performance yet, but I have some ideas I want to work on. Trev > > Richard. > > > Thanks, > > Pedro Alves > >