[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++/92393] Uniform initialization of non-copiable class data member cause to error

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

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

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |DUPLICATE

--- Comment #3 from Иван Бубников  ---
duplicate 63707

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

[Bug c++/92393] Uniform initialization of non-copiable class data member cause to error

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

--- Comment #2 from Иван Бубников  ---
(In reply to Jonathan Wakely from comment #1)
> Another dup of PR 63707 ?

Yes, it seems so. I`ll mark my request as duplicate. Thanks.

[Bug c++/92393] New: Uniform initialization of non-copiable class data member cause to error

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

Bug ID: 92393
   Summary: Uniform initialization of non-copiable class data
member cause to  error
   Product: gcc
   Version: 9.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: i.bubnikov at gmail dot com
  Target Milestone: ---

This is the short example of code that doesn`t compile with GCC9.2 or previous
but it must to according to c++ standart.

class A
{
public:

A(){};
A(const A &)=delete;
~A(){}
};

class B
{
public:

B() : a{}
{}

A a[1];
};

int main() 
{
B b;
}

According to c++17 standart:

If there are fewer initializer-clauses in the list than there are elements in a
non-union aggregate, then each element not explicitly initialized is
initialized as follows:

*If the element has a default member initializer ([class.mem]), the element is
initialized from that initializer.

*Otherwise, if the element is not a reference, the element is copy-initialized
from an empty initializer list ([dcl.init.list]).

*Otherwise, the program is ill-formed.

and

List-initialization of an object or reference of type T is defined as follows:

*[...]

*Otherwise, if the initializer list has no elements and T is a class type with
a default constructor, the object is value-initialized.

*[...]

Therefore, the default constructor of A is used directly. There's no copy
constructor involved.