public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95319] New: Regression from gcc9.3 when inserting into a vector with an initializer list. Error: a GNU-style designated initializer for class
@ 2020-05-25 16:35 haldormnk at hotmail dot com
  2020-05-26  7:19 ` [Bug c++/95319] [10/11 Regression] " rguenth at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: haldormnk at hotmail dot com @ 2020-05-25 16:35 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95319
           Summary: Regression from gcc9.3 when inserting into a vector
                    with an initializer list. Error: a GNU-style
                    designated initializer for class
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: haldormnk at hotmail dot com
  Target Milestone: ---

https://godbolt.org/z/zZtP9z

#include <iostream>
#include <array>
#include <vector>
int main() {
    using Array = std::array<double, 3>;
    using ArrayVector = std::vector<Array>;
    auto vector = ArrayVector();
    vector.emplace_back(Array({1,1,1})); // works
    vector.insert(std::end(vector),{{2,2,2}}); // fails in gcc10.1
}

With gcc9.3 it compiles, but with gcc10.1, there is an error in the last line:

error: '[0] =' used in a GNU-style designated initializer for class
'std::array<double, 3>'

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

* [Bug c++/95319] [10/11 Regression] Regression from gcc9.3 when inserting into a vector with an initializer list. Error: a GNU-style designated initializer for class
  2020-05-25 16:35 [Bug c++/95319] New: Regression from gcc9.3 when inserting into a vector with an initializer list. Error: a GNU-style designated initializer for class haldormnk at hotmail dot com
@ 2020-05-26  7:19 ` rguenth at gcc dot gnu.org
  2020-05-26  8:25 ` marxin at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-05-26  7:19 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
      Known to fail|                            |10.1.0
            Summary|Regression from gcc9.3 when |[10/11 Regression]
                   |inserting into a vector     |Regression from gcc9.3 when
                   |with an initializer list.   |inserting into a vector
                   |Error: a GNU-style          |with an initializer list.
                   |designated initializer for  |Error: a GNU-style
                   |class                       |designated initializer for
                   |                            |class
   Target Milestone|---                         |10.2
      Known to work|                            |9.3.0

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

* [Bug c++/95319] [10/11 Regression] Regression from gcc9.3 when inserting into a vector with an initializer list. Error: a GNU-style designated initializer for class
  2020-05-25 16:35 [Bug c++/95319] New: Regression from gcc9.3 when inserting into a vector with an initializer list. Error: a GNU-style designated initializer for class haldormnk at hotmail dot com
  2020-05-26  7:19 ` [Bug c++/95319] [10/11 Regression] " rguenth at gcc dot gnu.org
@ 2020-05-26  8:25 ` marxin at gcc dot gnu.org
  2020-05-26 21:53 ` jason at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-05-26  8:25 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org,
                   |                            |marxin at gcc dot gnu.org

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed, started with r10-6388-ge98ebda074bf8fc5.

Reduced test-case:

$ cat pr95319.ii
namespace std {
template <class> class initializer_list {
  int *_M_array;
  unsigned long _M_len;
};
template <int _Nm> struct A { typedef int _Type[_Nm]; };
template <int _Nm> struct B { typename A<_Nm>::_Type _M_elems; };
class C {
public:
  void insert(int, B<3>);
  void insert(int, initializer_list<B<3>>);
};
} // namespace std
int a;
int
main() {
  using ArrayVector = std::C;
  auto b = ArrayVector();
  b.insert(a, {{2}});
  return 0;
}

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

* [Bug c++/95319] [10/11 Regression] Regression from gcc9.3 when inserting into a vector with an initializer list. Error: a GNU-style designated initializer for class
  2020-05-25 16:35 [Bug c++/95319] New: Regression from gcc9.3 when inserting into a vector with an initializer list. Error: a GNU-style designated initializer for class haldormnk at hotmail dot com
  2020-05-26  7:19 ` [Bug c++/95319] [10/11 Regression] " rguenth at gcc dot gnu.org
  2020-05-26  8:25 ` marxin at gcc dot gnu.org
@ 2020-05-26 21:53 ` jason at gcc dot gnu.org
  2020-05-27 18:20 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2020-05-26 21:53 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |jason at gcc dot gnu.org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2020-05-26

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

* [Bug c++/95319] [10/11 Regression] Regression from gcc9.3 when inserting into a vector with an initializer list. Error: a GNU-style designated initializer for class
  2020-05-25 16:35 [Bug c++/95319] New: Regression from gcc9.3 when inserting into a vector with an initializer list. Error: a GNU-style designated initializer for class haldormnk at hotmail dot com
                   ` (2 preceding siblings ...)
  2020-05-26 21:53 ` jason at gcc dot gnu.org
@ 2020-05-27 18:20 ` cvs-commit at gcc dot gnu.org
  2020-05-27 18:24 ` cvs-commit at gcc dot gnu.org
  2020-05-27 18:27 ` jason at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-05-27 18:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 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:6efa97ea1d2fe6df1fbb9df78faaa2248a8618d7

commit r11-666-g6efa97ea1d2fe6df1fbb9df78faaa2248a8618d7
Author: Jason Merrill <jason@redhat.com>
Date:   Wed May 27 10:27:25 2020 -0400

    c++: Handle multiple aggregate overloads [PR95319].

    Here, when considering the two 'insert' overloads, we look for aggregate
    conversions from the same initializer-list to B<3> or
    initializer_list<B<3>>.  But since my fix for reshape_init overhead on the
    PR14179 testcase we reshaped the initializer-list directly, leading to an
    error when we then tried to reshape it differently for the second overload.

    gcc/cp/ChangeLog:

            PR c++/95319
            * decl.c (reshape_init_array_1): Don't reuse in overload context.

    gcc/testsuite/ChangeLog:

            PR c++/95319
            * g++.dg/cpp0x/initlist-array12.C: New test.

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

* [Bug c++/95319] [10/11 Regression] Regression from gcc9.3 when inserting into a vector with an initializer list. Error: a GNU-style designated initializer for class
  2020-05-25 16:35 [Bug c++/95319] New: Regression from gcc9.3 when inserting into a vector with an initializer list. Error: a GNU-style designated initializer for class haldormnk at hotmail dot com
                   ` (3 preceding siblings ...)
  2020-05-27 18:20 ` cvs-commit at gcc dot gnu.org
@ 2020-05-27 18:24 ` cvs-commit at gcc dot gnu.org
  2020-05-27 18:27 ` jason at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-05-27 18:24 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

commit r10-8192-ga6deb68d01316055072b8856185da4eaf77836d1
Author: Jason Merrill <jason@redhat.com>
Date:   Wed May 27 10:27:25 2020 -0400

    c++: Handle multiple aggregate overloads [PR95319].

    Here, when considering the two 'insert' overloads, we look for aggregate
    conversions from the same initializer-list to B<3> or
    initializer_list<B<3>>.  But since my fix for reshape_init overhead on the
    PR14179 testcase we reshaped the initializer-list directly, leading to an
    error when we then tried to reshape it differently for the second overload.

    gcc/cp/ChangeLog:

            PR c++/95319
            * decl.c (reshape_init_array_1): Don't reuse in overload context.

    gcc/testsuite/ChangeLog:

            PR c++/95319
            * g++.dg/cpp0x/initlist-array12.C: New test.

    (cherry picked from commit 6efa97ea1d2fe6df1fbb9df78faaa2248a8618d7)

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

* [Bug c++/95319] [10/11 Regression] Regression from gcc9.3 when inserting into a vector with an initializer list. Error: a GNU-style designated initializer for class
  2020-05-25 16:35 [Bug c++/95319] New: Regression from gcc9.3 when inserting into a vector with an initializer list. Error: a GNU-style designated initializer for class haldormnk at hotmail dot com
                   ` (4 preceding siblings ...)
  2020-05-27 18:24 ` cvs-commit at gcc dot gnu.org
@ 2020-05-27 18:27 ` jason at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2020-05-27 18:27 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for 10.2/11.

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

end of thread, other threads:[~2020-05-27 18:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-25 16:35 [Bug c++/95319] New: Regression from gcc9.3 when inserting into a vector with an initializer list. Error: a GNU-style designated initializer for class haldormnk at hotmail dot com
2020-05-26  7:19 ` [Bug c++/95319] [10/11 Regression] " rguenth at gcc dot gnu.org
2020-05-26  8:25 ` marxin at gcc dot gnu.org
2020-05-26 21:53 ` jason at gcc dot gnu.org
2020-05-27 18:20 ` cvs-commit at gcc dot gnu.org
2020-05-27 18:24 ` cvs-commit at gcc dot gnu.org
2020-05-27 18:27 ` 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).