public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jack Lloyd <lloyd@randombit.net>
To: Jonathan Wakely <jwakely.gcc@gmail.com>
Cc: gcc-help@gcc.gnu.org
Subject: Re: std::vector<__m128i> with non-standard allocators
Date: Mon, 11 Jun 2012 18:50:00 -0000	[thread overview]
Message-ID: <20120611185038.GN28623@randombit.net> (raw)
In-Reply-To: <CAH6eHdTnd52aFP-hqqhjEtGo3CDd3Bg5KxfqmxJAgJ9Q3vFwSA@mail.gmail.com>

On Mon, Jun 11, 2012 at 06:57:05PM +0100, Jonathan Wakely wrote:

> The C++ standard says that in a psuedo-destructor call (i.e. an
> expression like p->~U() for a non-class type) the operand shall be a
> scalar type, which would seem to rule out vector types (but then the
> standard says nothing about them anyway.)

Thanks, I had no realized that the standard allows that for scalar
types.

> You could either specialize the allocator's destroy function for the
> case of __m128i so it does nothing, or file a bug asking for
> pseudo-destructor calls to be allowed on types like __m128i.

I considered specialization but that requires me to guess what vector
types someone might want to use (the various AVX, NEON, and AltiVec
types all seem reasonable in the context of the allocator I'm writing)
and additionally pollute the namespace by pulling in headers to find
the definitions, so I was hoping for another approach.

It's definitely pretty unfortunate that this is rejected in that it
seems (?) like the intent of the pseudo-destructor syntax is to ensure
that p->~U() is always well formed precisely to allow uniform syntax
for cases like this. I suppose I'll file a bug and hope that people
working on the C++ FE agree this is a reasonable thing to support. It
looks like Clang 3.1 also rejects, Intel C++ 12.1 and Visual C++ 2010
accepts. Not sure about Comeau as the online compiler doesn't seem to
know about emmintrin.h

-Jack

  reply	other threads:[~2012-06-11 18:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-11 17:45 Jack Lloyd
2012-06-11 17:57 ` Jonathan Wakely
2012-06-11 18:50   ` Jack Lloyd [this message]
2012-06-11 19:21     ` 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=20120611185038.GN28623@randombit.net \
    --to=lloyd@randombit.net \
    --cc=gcc-help@gcc.gnu.org \
    --cc=jwakely.gcc@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).