public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/105925] New: [11.1 Regression] Could not convert '{{0, 0.0}}' from '<brace-enclosed initializer list>' to 'X'
@ 2022-06-11  8:53 jehova at existiert dot net
  2022-06-11 12:59 ` [Bug c++/105925] [11/12 " redi at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: jehova at existiert dot net @ 2022-06-11  8:53 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105925
           Summary: [11.1 Regression] Could not convert '{{0, 0.0}}' from
                    '<brace-enclosed initializer list>' to 'X'
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jehova at existiert dot net
  Target Milestone: ---

struct V
{
    int i;
    double d;
};

struct X
{
    union
    {
        int x;
        V y;
    };
};

X foo()
{
    return {.y = {0, 0.0}};
}

Compilation with 'g++ -std=c++20' works in 11.1 but fails for 11.2 and newer,
particularly in 12.1.

See https://godbolt.org/z/foq9aEs57

The code is also accepted by other major compilers (clang and MSVC).

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/105925] [11/12 Regression] Could not convert '{{0, 0.0}}' from '<brace-enclosed initializer list>' to 'X'
  2022-06-11  8:53 [Bug c++/105925] New: [11.1 Regression] Could not convert '{{0, 0.0}}' from '<brace-enclosed initializer list>' to 'X' jehova at existiert dot net
@ 2022-06-11 12:59 ` redi at gcc dot gnu.org
  2022-06-16 13:23 ` [Bug c++/105925] [11/12/13 " marxin at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2022-06-11 12:59 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[11.1 Regression] Could not |[11/12 Regression] Could
                   |convert '{{0, 0.0}}' from   |not convert '{{0, 0.0}}'
                   |'<brace-enclosed            |from '<brace-enclosed
                   |initializer list>' to 'X'   |initializer list>' to 'X'
   Target Milestone|---                         |11.4

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/105925] [11/12/13 Regression] Could not convert '{{0, 0.0}}' from '<brace-enclosed initializer list>' to 'X'
  2022-06-11  8:53 [Bug c++/105925] New: [11.1 Regression] Could not convert '{{0, 0.0}}' from '<brace-enclosed initializer list>' to 'X' jehova at existiert dot net
  2022-06-11 12:59 ` [Bug c++/105925] [11/12 " redi at gcc dot gnu.org
@ 2022-06-16 13:23 ` marxin at gcc dot gnu.org
  2022-06-16 13:23 ` marxin at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-06-16 13:23 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |marxin at gcc dot gnu.org

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Dup.

*** This bug has been marked as a duplicate of bug 101837 ***

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/105925] [11/12/13 Regression] Could not convert '{{0, 0.0}}' from '<brace-enclosed initializer list>' to 'X'
  2022-06-11  8:53 [Bug c++/105925] New: [11.1 Regression] Could not convert '{{0, 0.0}}' from '<brace-enclosed initializer list>' to 'X' jehova at existiert dot net
  2022-06-11 12:59 ` [Bug c++/105925] [11/12 " redi at gcc dot gnu.org
  2022-06-16 13:23 ` [Bug c++/105925] [11/12/13 " marxin at gcc dot gnu.org
@ 2022-06-16 13:23 ` marxin at gcc dot gnu.org
  2022-06-16 13:24 ` [Bug c++/105925] [11/12/13 Regression] Could not convert '{{0, 0.0}}' from '<brace-enclosed initializer list>' to 'X' since r12-954-g84fd1b5dff70cd74 marxin at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-06-16 13:23 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|DUPLICATE                   |---
             Status|RESOLVED                    |NEW
   Last reconfirmed|                            |2022-06-16
     Ever confirmed|0                           |1

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Sorry, wrong bug.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/105925] [11/12/13 Regression] Could not convert '{{0, 0.0}}' from '<brace-enclosed initializer list>' to 'X' since r12-954-g84fd1b5dff70cd74
  2022-06-11  8:53 [Bug c++/105925] New: [11.1 Regression] Could not convert '{{0, 0.0}}' from '<brace-enclosed initializer list>' to 'X' jehova at existiert dot net
                   ` (2 preceding siblings ...)
  2022-06-16 13:23 ` marxin at gcc dot gnu.org
@ 2022-06-16 13:24 ` marxin at gcc dot gnu.org
  2022-06-23 15:42 ` jason at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-06-16 13:24 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[11/12/13 Regression] Could |[11/12/13 Regression] Could
                   |not convert '{{0, 0.0}}'    |not convert '{{0, 0.0}}'
                   |from '<brace-enclosed       |from '<brace-enclosed
                   |initializer list>' to 'X'   |initializer list>' to 'X'
                   |                            |since
                   |                            |r12-954-g84fd1b5dff70cd74
           Keywords|needs-bisection             |
                 CC|                            |jason at gcc dot gnu.org

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r12-954-g84fd1b5dff70cd74.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/105925] [11/12/13 Regression] Could not convert '{{0, 0.0}}' from '<brace-enclosed initializer list>' to 'X' since r12-954-g84fd1b5dff70cd74
  2022-06-11  8:53 [Bug c++/105925] New: [11.1 Regression] Could not convert '{{0, 0.0}}' from '<brace-enclosed initializer list>' to 'X' jehova at existiert dot net
                   ` (3 preceding siblings ...)
  2022-06-16 13:24 ` [Bug c++/105925] [11/12/13 Regression] Could not convert '{{0, 0.0}}' from '<brace-enclosed initializer list>' to 'X' since r12-954-g84fd1b5dff70cd74 marxin at gcc dot gnu.org
@ 2022-06-23 15:42 ` jason at gcc dot gnu.org
  2022-06-23 21:16 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2022-06-23 15:42 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |jason at gcc dot gnu.org

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/105925] [11/12/13 Regression] Could not convert '{{0, 0.0}}' from '<brace-enclosed initializer list>' to 'X' since r12-954-g84fd1b5dff70cd74
  2022-06-11  8:53 [Bug c++/105925] New: [11.1 Regression] Could not convert '{{0, 0.0}}' from '<brace-enclosed initializer list>' to 'X' jehova at existiert dot net
                   ` (4 preceding siblings ...)
  2022-06-23 15:42 ` jason at gcc dot gnu.org
@ 2022-06-23 21:16 ` cvs-commit at gcc dot gnu.org
  2022-06-23 21:17 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-06-23 21:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:d610ae121e8ecd738de4dc01e6ac11ecf7c2327e

commit r13-1226-gd610ae121e8ecd738de4dc01e6ac11ecf7c2327e
Author: Jason Merrill <jason@redhat.com>
Date:   Thu Jun 23 16:04:02 2022 -0400

    c++: anon union designated init [PR105925]

    This testcase was failing because CONSTRUCTOR_IS_DESIGNATED_INIT wasn't
    getting set on the introduced CONSTRUCTOR for the anonymous union, and
    build_aggr_conv uses that flag to decide whether to pay attention to the
    indexes of the CONSTRUCTOR.  So set the flag when we see a designator
rather
    than relying on copying it from another CONSTRUCTOR.

    This avoids some redundant errors on desig4.C because we stop setting
    CONSTRUCTOR_IS_DESIGNATED_INIT on _Complex CONSTRUCTORs where it's
    nonsense.

            PR c++/105925

    gcc/cp/ChangeLog:

            * decl.cc (reshape_init_array_1): Set
            CONSTRUCTOR_IS_DESIGNATED_INIT here.
            (reshape_init_class): And here.
            (reshape_init): Not here.

    gcc/testsuite/ChangeLog:

            * g++.dg/ext/desig4.C: Remove extra errors.
            * g++.dg/cpp2a/desig26.C: New test.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/105925] [11/12/13 Regression] Could not convert '{{0, 0.0}}' from '<brace-enclosed initializer list>' to 'X' since r12-954-g84fd1b5dff70cd74
  2022-06-11  8:53 [Bug c++/105925] New: [11.1 Regression] Could not convert '{{0, 0.0}}' from '<brace-enclosed initializer list>' to 'X' jehova at existiert dot net
                   ` (5 preceding siblings ...)
  2022-06-23 21:16 ` cvs-commit at gcc dot gnu.org
@ 2022-06-23 21:17 ` cvs-commit at gcc dot gnu.org
  2022-06-23 21:38 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-06-23 21:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:6c72f1bfc3469422460d86314a081353632d4bcb

commit r13-1227-g6c72f1bfc3469422460d86314a081353632d4bcb
Author: Jason Merrill <jason@redhat.com>
Date:   Thu Jun 23 14:41:19 2022 -0400

    c++: designated init cleanup [PR105925]

    build_aggr_conv expects to run after reshape_init, which will usually have
    filled out all the CONSTRUCTOR indexes; there's no reason to limit using
    those to the case where the user gave an explicit designator.

            PR c++/105925

    gcc/cp/ChangeLog:

            * call.cc (build_aggr_conv): Don't depend on
            CONSTRUCTOR_IS_DESIGNATED_INIT.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/105925] [11/12/13 Regression] Could not convert '{{0, 0.0}}' from '<brace-enclosed initializer list>' to 'X' since r12-954-g84fd1b5dff70cd74
  2022-06-11  8:53 [Bug c++/105925] New: [11.1 Regression] Could not convert '{{0, 0.0}}' from '<brace-enclosed initializer list>' to 'X' jehova at existiert dot net
                   ` (6 preceding siblings ...)
  2022-06-23 21:17 ` cvs-commit at gcc dot gnu.org
@ 2022-06-23 21:38 ` cvs-commit at gcc dot gnu.org
  2022-06-24  0:45 ` cvs-commit at gcc dot gnu.org
  2022-06-24  0:46 ` jason at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-06-23 21:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:

https://gcc.gnu.org/g:db29b66193407d2fd6a04a07ecbd961c8d3f7d62

commit r12-8511-gdb29b66193407d2fd6a04a07ecbd961c8d3f7d62
Author: Jason Merrill <jason@redhat.com>
Date:   Thu Jun 23 16:04:02 2022 -0400

    c++: anon union designated init [PR105925]

    This testcase was failing because CONSTRUCTOR_IS_DESIGNATED_INIT wasn't
    getting set on the introduced CONSTRUCTOR for the anonymous union, and
    build_aggr_conv uses that flag to decide whether to pay attention to the
    indexes of the CONSTRUCTOR.  So set the flag when we see a designator
rather
    than relying on copying it from another CONSTRUCTOR.

            PR c++/105925

    gcc/cp/ChangeLog:

            * decl.cc (reshape_init_array_1): Set
            CONSTRUCTOR_IS_DESIGNATED_INIT here.
            (reshape_init_class): And here.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/desig26.C: New test.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/105925] [11/12/13 Regression] Could not convert '{{0, 0.0}}' from '<brace-enclosed initializer list>' to 'X' since r12-954-g84fd1b5dff70cd74
  2022-06-11  8:53 [Bug c++/105925] New: [11.1 Regression] Could not convert '{{0, 0.0}}' from '<brace-enclosed initializer list>' to 'X' jehova at existiert dot net
                   ` (7 preceding siblings ...)
  2022-06-23 21:38 ` cvs-commit at gcc dot gnu.org
@ 2022-06-24  0:45 ` cvs-commit at gcc dot gnu.org
  2022-06-24  0:46 ` jason at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-06-24  0:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:

https://gcc.gnu.org/g:553aecc570ce4ef5c751dc39b83bfbde6380f953

commit r11-10091-g553aecc570ce4ef5c751dc39b83bfbde6380f953
Author: Jason Merrill <jason@redhat.com>
Date:   Thu Jun 23 16:04:02 2022 -0400

    c++: anon union designated init [PR105925]

    This testcase was failing because CONSTRUCTOR_IS_DESIGNATED_INIT wasn't
    getting set on the introduced CONSTRUCTOR for the anonymous union, and
    build_aggr_conv uses that flag to decide whether to pay attention to the
    indexes of the CONSTRUCTOR.  So set the flag when we see a designator
rather
    than relying on copying it from another CONSTRUCTOR.

            PR c++/105925

    gcc/cp/ChangeLog:

            * decl.c (reshape_init_array_1): Set
            CONSTRUCTOR_IS_DESIGNATED_INIT here.
            (reshape_init_class): And here.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/desig26.C: New test.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/105925] [11/12/13 Regression] Could not convert '{{0, 0.0}}' from '<brace-enclosed initializer list>' to 'X' since r12-954-g84fd1b5dff70cd74
  2022-06-11  8:53 [Bug c++/105925] New: [11.1 Regression] Could not convert '{{0, 0.0}}' from '<brace-enclosed initializer list>' to 'X' jehova at existiert dot net
                   ` (8 preceding siblings ...)
  2022-06-24  0:45 ` cvs-commit at gcc dot gnu.org
@ 2022-06-24  0:46 ` jason at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2022-06-24  0:46 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
      Known to work|                            |11.3.1, 12.1.1, 13.0

--- Comment #8 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for 11.4/12.2/13.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-06-24  0:46 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-11  8:53 [Bug c++/105925] New: [11.1 Regression] Could not convert '{{0, 0.0}}' from '<brace-enclosed initializer list>' to 'X' jehova at existiert dot net
2022-06-11 12:59 ` [Bug c++/105925] [11/12 " redi at gcc dot gnu.org
2022-06-16 13:23 ` [Bug c++/105925] [11/12/13 " marxin at gcc dot gnu.org
2022-06-16 13:23 ` marxin at gcc dot gnu.org
2022-06-16 13:24 ` [Bug c++/105925] [11/12/13 Regression] Could not convert '{{0, 0.0}}' from '<brace-enclosed initializer list>' to 'X' since r12-954-g84fd1b5dff70cd74 marxin at gcc dot gnu.org
2022-06-23 15:42 ` jason at gcc dot gnu.org
2022-06-23 21:16 ` cvs-commit at gcc dot gnu.org
2022-06-23 21:17 ` cvs-commit at gcc dot gnu.org
2022-06-23 21:38 ` cvs-commit at gcc dot gnu.org
2022-06-24  0:45 ` cvs-commit at gcc dot gnu.org
2022-06-24  0:46 ` jason at gcc dot gnu.org

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).