public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "drahflow at gmx dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/106233] New: Designated initializers targeting inherited fields breaks reshape_init_class, at cp/decl.c:6456
Date: Fri, 08 Jul 2022 12:14:13 +0000	[thread overview]
Message-ID: <bug-106233-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106233

            Bug ID: 106233
           Summary: Designated initializers targeting inherited fields
                    breaks reshape_init_class, at cp/decl.c:6456
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: drahflow at gmx dot de
  Target Milestone: ---

In a vain attempt to use designated initializers to target inherited fields, I
discovered that running

g++ -W -Wall --std=c++20

... on ...

struct Base {
  int i;
};

struct Derived: public Base {
  using Base::i;
};

int main(void) {
  Derived d{
    .i = 0,
  };

  return d.i;
}

... results in ...

designated-usage.c++: In function ‘int main()’:
designated-usage.c++:12:3: internal compiler error: in reshape_init_class, at
cp/decl.c:6456
   12 |   };
      |   ^
0x7f080f8137fc __libc_start_main
        ../csu/libc-start.c:332
Please submit a full bug report, [...]

... for ...

g++ --version
g++ (Debian 11.2.0-18) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.



GCC 12.1 gives

<source>: In function 'int main()':
<source>:12:3: error: 'Base::i' is not a direct member of 'Derived'
   12 |   };
      |   ^
Compiler returned: 1

... the correctness of which I don't feel qualified to judge.

             reply	other threads:[~2022-07-08 12:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-08 12:14 drahflow at gmx dot de [this message]
2022-07-08 12:54 ` [Bug c++/106233] " marxin at gcc dot gnu.org
2022-07-08 12:55 ` marxin at gcc dot gnu.org
2022-07-08 20:06 ` [Bug c++/106233] [11 Regression] " pinskia at gcc dot gnu.org
2023-05-29 10:07 ` jakub at gcc dot gnu.org

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=bug-106233-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).