public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: Ville Voutilainen <ville.voutilainen@gmail.com>
Cc: Marc Glisse <marc.glisse@inria.fr>,
	libstdc++ <libstdc++@gcc.gnu.org>,
	gcc-patches List <gcc-patches@gcc.gnu.org>
Subject: Re: vector<bool> _M_start and 0 offset
Date: Mon, 17 Sep 2018 19:18:00 -0000	[thread overview]
Message-ID: <20180917191156.GS23172@redhat.com> (raw)
In-Reply-To: <20180917191002.GR23172@redhat.com>

On 17/09/18 20:10 +0100, Jonathan Wakely wrote:
>On 17/09/18 21:55 +0300, Ville Voutilainen wrote:
>>On Mon, 17 Sep 2018 at 21:50, Jonathan Wakely <jwakely@redhat.com> wrote:
>>>"I used C++11 syntax because I find it nicer, and the compiler accepts
>>>>it in C++98 mode with just a warning, suppressed in a standard
>>>>header."
>>>
>>>Oh sorry, I just looked at the patch and replied without reading the
>>>top bit.
>>>
>>>>Even with -Wsystem-headers I don't get a warning, I have to precompile
>>>>with -P -E then compile the result to get "warning: extended
>>>>initializer lists only available with -std=c++11 or -std=gnu++11".
>>>
>>>OK for trunk then.
>>
>>Do other compilers besides gcc suppress the same way?
>
>No, clang doesn't:
>
>In file included from bv.cc:1:
>In file included from /home/jwakely/gcc/latest/lib/gcc/x86_64-pc-linux-gnu/9.0.0/../../../../include/c++/9.0.0/vector:65:
>/home/jwakely/gcc/latest/lib/gcc/x86_64-pc-linux-gnu/9.0.0/../../../../include/c++/9.0.0/bits/stl_bvector.h:812:16: error: non-aggregate type 'std::vector<bool, type-parameter-0-0>::iterator' (aka 'std::_Bit_iterator') cannot be initialized with an initializer list
>     { return { this->_M_impl._M_start, 0 }; }

And for the avoidance of doubt, it's the same error if I make the
correct change to the header:

      { return { this->_M_impl._M_start._M_p, 0 }; }


>              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>bv.cc:6:5: note: in instantiation of member function 'std::vector<bool, std::allocator<bool> >::begin' requested here
> b.begin();
>   ^
>1 error generated.
>
>So I do think we should stick to C++98 syntax.
>

  reply	other threads:[~2018-09-17 19:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-15 14:12 Marc Glisse
2018-09-17 16:29 ` Jonathan Wakely
2018-09-17 18:20   ` Marc Glisse
2018-09-17 18:55     ` Jonathan Wakely
2018-09-17 19:10       ` Ville Voutilainen
2018-09-17 19:12         ` Jonathan Wakely
2018-09-17 19:18           ` Jonathan Wakely [this message]
2018-09-17 19:22           ` Marc Glisse
2018-09-17 19:28             ` Marc Glisse
2018-09-17 19:50               ` Jonathan Wakely
2018-09-17 20:05                 ` Marc Glisse
2018-09-29 11:06                 ` Marc Glisse
2018-10-01 12:45                   ` Jonathan Wakely
2018-09-17 19:36             ` Jonathan Wakely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180917191156.GS23172@redhat.com \
    --to=jwakely@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    --cc=marc.glisse@inria.fr \
    --cc=ville.voutilainen@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).