[Bug c++/63707] Brace initialization of array sometimes fails if no copy constructor

2022-08-31 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63707

Martin Liška  changed:

   What|Removed |Added

 CC||jlame646 at gmail dot com

--- Comment #25 from Martin Liška  ---
*** Bug 106788 has been marked as a duplicate of this bug. ***

[Bug c++/63707] Brace initialization of array sometimes fails if no copy constructor

2021-12-08 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63707

Andrew Pinski  changed:

   What|Removed |Added

 CC||l2m at ukr dot net

--- Comment #24 from Andrew Pinski  ---
*** Bug 91499 has been marked as a duplicate of this bug. ***

[Bug c++/63707] Brace initialization of array sometimes fails if no copy constructor

2021-08-13 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63707

Andrew Pinski  changed:

   What|Removed |Added

 CC||richard-gccbugzilla@metafoo
   ||.co.uk

--- Comment #23 from Andrew Pinski  ---
*** Bug 68709 has been marked as a duplicate of this bug. ***

[Bug c++/63707] Brace initialization of array sometimes fails if no copy constructor

2021-01-29 Thread eyalroz1 at gmx dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63707

--- Comment #22 from Eyal Rozenberg  ---
Thank you, Jason and others, for your attentiveness to interest in the bug and
prioritizing its fix. (Now if you could just fix all the other bugs I'm
interested in... :-P)

[Bug c++/63707] Brace initialization of array sometimes fails if no copy constructor

2021-01-29 Thread jason at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63707

Jason Merrill  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED
   Target Milestone|--- |9.4

--- Comment #21 from Jason Merrill  ---
Also fixed for 9.4 and 10.3.

[Bug c++/63707] Brace initialization of array sometimes fails if no copy constructor

2021-01-29 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63707

--- Comment #20 from CVS Commits  ---
The releases/gcc-9 branch has been updated by Jason Merrill
:

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

commit r9-9212-gca02f0a0eb0fbeb3c1e01c3a55a95b0690ecfabc
Author: Jason Merrill 
Date:   Fri Jan 15 11:42:00 2021 -0500

c++: Fix list-init of array of no-copy type [PR63707]

build_vec_init_elt models initialization from some arbitrary object of the
type, i.e. copy, but in the case of list-initialization we don't do a copy
from the elements, we initialize them directly.

gcc/cp/ChangeLog:

PR c++/63707
* tree.c (build_vec_init_expr): Don't call build_vec_init_elt
if we got a CONSTRUCTOR.

gcc/testsuite/ChangeLog:

PR c++/63707
* g++.dg/cpp0x/initlist-array13.C: New test.

[Bug c++/63707] Brace initialization of array sometimes fails if no copy constructor

2021-01-29 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63707

--- Comment #19 from CVS Commits  ---
The releases/gcc-10 branch has been updated by Jason Merrill
:

https://gcc.gnu.org/g:81fd2df5911c4b2c31960fa5ef1407d20f1ca50c

commit r10-9311-g81fd2df5911c4b2c31960fa5ef1407d20f1ca50c
Author: Jason Merrill 
Date:   Fri Jan 15 11:42:00 2021 -0500

c++: Fix list-init of array of no-copy type [PR63707]

build_vec_init_elt models initialization from some arbitrary object of the
type, i.e. copy, but in the case of list-initialization we don't do a copy
from the elements, we initialize them directly.

gcc/cp/ChangeLog:

PR c++/63707
* tree.c (build_vec_init_expr): Don't call build_vec_init_elt
if we got a CONSTRUCTOR.

gcc/testsuite/ChangeLog:

PR c++/63707
* g++.dg/cpp0x/initlist-array13.C: New test.

[Bug c++/63707] Brace initialization of array sometimes fails if no copy constructor

2021-01-15 Thread jason at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63707

Jason Merrill  changed:

   What|Removed |Added

  Known to work||11.0
  Known to fail|11.0|

--- Comment #18 from Jason Merrill  ---
Fixed for GCC 11 so far.

[Bug c++/63707] Brace initialization of array sometimes fails if no copy constructor

2021-01-15 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63707

--- Comment #17 from CVS Commits  ---
The master branch has been updated by Jason Merrill :

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

commit r11-6733-gcd09079cfd50d289cbb05eadb728a0713f6bae8a
Author: Jason Merrill 
Date:   Fri Jan 15 11:42:00 2021 -0500

c++: Fix list-init of array of no-copy type [PR63707]

build_vec_init_elt models initialization from some arbitrary object of the
type, i.e. copy, but in the case of list-initialization we don't do a copy
from the elements, we initialize them directly.

gcc/cp/ChangeLog:

PR c++/63707
* tree.c (build_vec_init_expr): Don't call build_vec_init_elt
if we got a CONSTRUCTOR.

gcc/testsuite/ChangeLog:

PR c++/63707
* g++.dg/cpp0x/initlist-array13.C: New test.

[Bug c++/63707] Brace initialization of array sometimes fails if no copy constructor

2021-01-14 Thread jason at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63707

Jason Merrill  changed:

   What|Removed |Added

   Assignee|mpolacek at gcc dot gnu.org|jason at gcc dot gnu.org
 CC||jason at gcc dot gnu.org

--- Comment #16 from Jason Merrill  ---
Mine.

[Bug c++/63707] Brace initialization of array sometimes fails if no copy constructor

2021-01-12 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63707

Marek Polacek  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED

[Bug c++/63707] Brace initialization of array sometimes fails if no copy constructor

2021-01-12 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63707

Marek Polacek  changed:

   What|Removed |Added

   Assignee|unassigned at gcc dot gnu.org  |mpolacek at gcc dot 
gnu.org
 CC||mpolacek at gcc dot gnu.org

--- Comment #15 from Marek Polacek  ---
Looking.

[Bug c++/63707] Brace initialization of array sometimes fails if no copy constructor

2021-01-12 Thread pdimov at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63707

Peter Dimov  changed:

   What|Removed |Added

 CC||pdimov at gmail dot com

--- Comment #14 from Peter Dimov  ---
FWIW, I just hit this problem as well when trying to make changes to
Boost.Variant2. My reduced test case is https://godbolt.org/z/zG6ddP; I was
going to submit that as a bug but found this one.

I support the petition to have this fixed.

[Bug c++/63707] Brace initialization of array sometimes fails if no copy constructor

2020-12-10 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63707

--- Comment #13 from Jakub Jelinek  ---
At least for #c5 the important difference between that testcase and // ~Child
();
which is accepted is I think since
r0-113052-ge2df21bfc6c81b4bc410a42002c8427454ffa628
in the cp/init.c (perform_member_init) code:
888   /* A FIELD_DECL doesn't really have a suitable lifetime, but
889  make_temporary_var_for_ref_to_temp will treat it as automatic
and
890  set_up_extended_ref_temp wants to use the decl in a warning. 
*/
891   init = extend_ref_init_temps (member, init, );
892   if (TREE_CODE (type) == ARRAY_TYPE
893   && TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TREE_TYPE (type)))
894 init = build_vec_init_expr (type, init, tf_warning_or_error);
If it has trivial destructor, nothing calls build_vec_init_expr and the copy
ctor isn't needed, but when it is called, it is needed.
I think in this case extend_ref_init_temps doesn't do anything at all, so it is
unclear if build_vec_init_expr is needed too or not.

[Bug c++/63707] Brace initialization of array sometimes fails if no copy constructor

2020-12-06 Thread eyalroz at technion dot ac.il via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63707

Eyal Rozenberg  changed:

   What|Removed |Added

 CC||eyalroz at technion dot ac.il

--- Comment #12 from Eyal Rozenberg  ---
Rejection valid code, especially valid code which is not contrived and can well
occur in people's real-life work, seems like a high-priority bug.

The last substantive comment here, other than dupe-marking-related comments two
years ago, is comment #8, asking for this to be fixed - four and a half years
ago.

Jonathan and others - please try to prioritize fixing this, and even if you
can't for some reason - at least explain which this can't be fixed promptly.

See also:

https://stackoverflow.com/q/65138048/1593077

[Bug c++/63707] Brace initialization of array sometimes fails if no copy constructor

2019-11-19 Thread i.bubnikov at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63707

Иван Бубников  changed:

   What|Removed |Added

 CC||i.bubnikov at gmail dot com

--- Comment #11 from Иван Бубников  ---
*** Bug 92393 has been marked as a duplicate of this bug. ***

[Bug c++/63707] Brace initialization of array sometimes fails if no copy constructor

2018-04-30 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63707

--- Comment #10 from Jonathan Wakely  ---
Testcase from PR 70395

struct NonCopyable {
  NonCopyable(const NonCopyable&) = delete;
  NonCopyable(NonCopyable&&) = delete;
  NonCopyable& operator=(const NonCopyable&) = delete;
  NonCopyable& operator=(NonCopyable&&) = delete;

  NonCopyable() {}

  ~NonCopyable() {} // to make it non-trivial
};

struct A {
  A(): _a{} {}
  ~A() {}

  NonCopyable _a[5];
} a;

[Bug c++/63707] Brace initialization of array sometimes fails if no copy constructor

2018-04-30 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63707

Jonathan Wakely  changed:

   What|Removed |Added

 CC||mosra at centrum dot cz

--- Comment #9 from Jonathan Wakely  ---
*** Bug 70395 has been marked as a duplicate of this bug. ***

[Bug c++/63707] Brace initialization of array sometimes fails if no copy constructor

2016-06-07 Thread john.lindgren at aol dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63707

John Lindgren  changed:

   What|Removed |Added

  Known to fail||6.1.1

--- Comment #8 from John Lindgren  ---
Just ran into this bug again with GCC 6.1.1.  Any hope of this ever getting
fixed?

[Bug c++/63707] Brace initialization of array sometimes fails if no copy constructor

2015-01-31 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63707

--- Comment #7 from Jonathan Wakely redi at gcc dot gnu.org ---
Reduced from PR 64887:

struct string
{
  string(const char*) { }
  ~string(); // make this type non-trivial
};

struct A
{
  string s;
  A() = delete;
  A(const A) = delete;
  A(A) = delete;
  A(const char*);
};

A arr[2] = {{a}, {b}}; // ok

struct Aggr {
  A arr[2];
  Aggr() : arr{{a}, {b}} {} // error
};

The member of non-trivial type is required to trigger the error, presumably
because it makes the destructor non-trivial.


[Bug c++/63707] Brace initialization of array sometimes fails if no copy constructor

2015-01-31 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63707

Jonathan Wakely redi at gcc dot gnu.org changed:

   What|Removed |Added

 CC||cth027 at yahoo dot de

--- Comment #6 from Jonathan Wakely redi at gcc dot gnu.org ---
*** Bug 64887 has been marked as a duplicate of this bug. ***


[Bug c++/63707] Brace initialization of array sometimes fails if no copy constructor

2015-01-28 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63707

--- Comment #5 from Jonathan Wakely redi at gcc dot gnu.org ---
The member array case only fails when the array element has a user-defined
destructor

Here's the failing testcase repeated from the attachment and reduced slightly:

struct Child
{
Child (int);
~Child ();
Child (const Child ) = delete;
};

struct Parent
{
Parent () : children {{5}, {7}} {}

Child children[2];
};


i.cc: In constructor ‘Parent::Parent()’:
i.cc:12:35: error: use of deleted function ‘Child::Child(const Child)’
 Parent () : children {{5}, {7}} {}
   ^
i.cc:6:5: note: declared here
 Child (const Child ) = delete;
 ^

Commenting out the destructor declaration allows it to compile.

[Bug c++/63707] Brace initialization of array sometimes fails if no copy constructor

2014-12-12 Thread ville.voutilainen at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63707

Ville Voutilainen ville.voutilainen at gmail dot com changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2014-12-12
 CC||ville.voutilainen at gmail dot 
com
 Ever confirmed|0   |1
  Known to fail||4.8.2, 4.9.1, 5.0


[Bug c++/63707] Brace initialization of array sometimes fails if no copy constructor

2014-11-01 Thread john.lindgren at aol dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63707

--- Comment #1 from John Lindgren john.lindgren at aol dot com ---
Created attachment 33860
  -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=33860action=edit
Test case 2


[Bug c++/63707] Brace initialization of array sometimes fails if no copy constructor

2014-11-01 Thread john.lindgren at aol dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63707

--- Comment #2 from John Lindgren john.lindgren at aol dot com ---
Created attachment 33861
  -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=33861action=edit
Test case 3


[Bug c++/63707] Brace initialization of array sometimes fails if no copy constructor

2014-11-01 Thread john.lindgren at aol dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63707

--- Comment #3 from John Lindgren john.lindgren at aol dot com ---
Created attachment 33862
  -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=33862action=edit
Test case 4


[Bug c++/63707] Brace initialization of array sometimes fails if no copy constructor

2014-11-01 Thread john.lindgren at aol dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63707

John Lindgren john.lindgren at aol dot com changed:

   What|Removed |Added

  Attachment #33860|0   |1
is obsolete||

--- Comment #4 from John Lindgren john.lindgren at aol dot com ---
Created attachment 33863
  -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=33863action=edit
Corrected test case 2

Corrected test case 2 (previous was identical to test case 1).