public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: Hans-Peter Nilsson <hp@axis.com>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>,
	"libstdc++" <libstdc++@gcc.gnu.org>
Subject: Re: [PATCH] libstdc++-v3 expected: Don't test ABI-variant properties in requirements.cc
Date: Tue, 5 Apr 2022 19:47:58 +0100	[thread overview]
Message-ID: <CAH6eHdRbBKQN=Q8h0_uummLMt1hinrSuN=DTA7Bz8svA2sO9mg@mail.gmail.com> (raw)
In-Reply-To: <20220405164329.99C9F20426@pchp3.se.axis.com>

On Tue, 5 Apr 2022, 17:44 Hans-Peter Nilsson via Libstdc++, <
libstdc++@gcc.gnu.org> wrote:

> Ok to commit?
> -------------- 8< --------------
>
> Without this, for a target where alignment and structure-sizes are by
> default byte-aligned, such as cris-elf, you'll see, in libstdc++.log:
>
> /X/gcc/libstdc++-v3/testsuite/20_util/expected/requirements.cc:127: error:
> static assertion failed
> /X/gcc/libstdc++-v3/testsuite/20_util/expected/requirements.cc:127: note:
> the comparison reduces to '(5 == 2)'
> compiler exited with status 1
> FAIL: 20_util/expected/requirements.cc (test for excess errors)
> Excess errors:
> /X/gcc/libstdc++-v3/testsuite/20_util/expected/requirements.cc:127: error:
> static assertion failed
>
> It seems the intent is a smoke-test and that conditionals for ABI
> properties are out of scope, so best to just delete this particular
> line.
>

The idea is to ensure the object is no larger than necessary.

I think we could use == sizeof(void*)+alignof(void*) which would be correct
everywhere. Does that work for cris-elf?



> libstdc++-v3/:
>         * testsuite/20_util/expected/requirements.cc: Don't test
>         ABI-variant properties of expected<>.
> ---
>  libstdc++-v3/testsuite/20_util/expected/requirements.cc | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/libstdc++-v3/testsuite/20_util/expected/requirements.cc
> b/libstdc++-v3/testsuite/20_util/expected/requirements.cc
> index 485aa338679c..a51a007a4fc3 100644
> --- a/libstdc++-v3/testsuite/20_util/expected/requirements.cc
> +++ b/libstdc++-v3/testsuite/20_util/expected/requirements.cc
> @@ -124,6 +124,5 @@ static_assert( move_assignable< void, G > );
>  // QoI properties
>  static_assert( sizeof(std::expected<char, unsigned char>) == 2 );
>  static_assert( sizeof(std::expected<void, char>) == 2 );
> -static_assert( sizeof(std::expected<void*, char>) == 2 * __alignof(void*)
> );
>  static_assert( alignof(std::expected<void, char>) == 1 );
>  static_assert( alignof(std::expected<void*, char>) == alignof(void*) );
> --
> 2.30.2
>
>

  reply	other threads:[~2022-04-05 18:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-05 16:43 Hans-Peter Nilsson
2022-04-05 18:47 ` Jonathan Wakely [this message]
2022-04-06 14:42   ` Hans-Peter Nilsson
2022-04-06 15:57     ` 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='CAH6eHdRbBKQN=Q8h0_uummLMt1hinrSuN=DTA7Bz8svA2sO9mg@mail.gmail.com' \
    --to=jwakely.gcc@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hp@axis.com \
    --cc=libstdc++@gcc.gnu.org \
    /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).