public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Mike Stump <mikestump@comcast.net>
To: David Edelsohn <dje.gcc@gmail.com>
Cc: Jonathan Wakely <jwakely.gcc@gmail.com>,
	GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] g++.dg/cpp1y/pr58708.C wchar_t size
Date: Tue, 17 Nov 2015 23:41:00 -0000	[thread overview]
Message-ID: <A1657FEC-DA38-4118-9B67-066A960DA78F@comcast.net> (raw)
In-Reply-To: <CAGWvny=isqxyzCn+q1VoBGRA8WyqN9Ou_ErFq=d3VbWXB51LwA@mail.gmail.com>

On Nov 17, 2015, at 8:50 AM, David Edelsohn <dje.gcc@gmail.com> wrote:
> 
> Thanks for the pointer.  How about the following?

Ok.

sizeof (*wfoo) or sizeof (wchar_t) or some such might be even more portable.

> 
> Thanks, David
> 
> 
> Index: pr58708.C
> ===================================================================
> --- pr58708.C   (revision 230463)
> +++ pr58708.C   (working copy)
> @@ -43,7 +43,11 @@
>   if (foo.chars[1] != 98) __builtin_abort();
>   if (foo.chars[2] != 99) __builtin_abort();
> 
> -  auto wfoo = L"\x01020304\x05060708"_foo;
> +#if __SIZEOF_WCHAR_T__ == 2
> +    auto wfoo = L"\x0102\x0304"_foo;
> +#else
> +    auto wfoo = L"\x01020304\x05060708"_foo;
> +#endif
>   if (is_same<decltype(wfoo)::char_type, wchar_t>::value != true)
> __builtin_abort();
>   if (sizeof(wfoo.chars)/sizeof(wchar_t) != 2) __builtin_abort();
>   if (wfoo.chars[0] != 16909060) __builtin_abort();

      reply	other threads:[~2015-11-17 23:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-17 16:04 David Edelsohn
2015-11-17 16:22 ` Jonathan Wakely
2015-11-17 16:50   ` David Edelsohn
2015-11-17 23:41     ` Mike Stump [this message]

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=A1657FEC-DA38-4118-9B67-066A960DA78F@comcast.net \
    --to=mikestump@comcast.net \
    --cc=dje.gcc@gmail.com \
    --cc=gcc-patches@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).