[Bug c++/57082] brace initialization requires public destructor

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

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #9 from Andrew Pinski  ---
Fixed for GCC 9.3 and GCC 10+.

[Bug c++/57082] brace initialization requires public destructor

2019-12-17 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57082

Jason Merrill  changed:

   What|Removed |Added

  Known to work||10.0, 9.2.1
  Known to fail|10.0|

--- Comment #8 from Jason Merrill  ---
Fixed for 9.3/10.  Does anyone think it's important to fix this in 8.4?

[Bug c++/57082] brace initialization requires public destructor

2019-12-12 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57082

--- Comment #7 from Jason Merrill  ---
Author: jason
Date: Fri Dec 13 05:10:11 2019
New Revision: 279335

URL: https://gcc.gnu.org/viewcvs?rev=279335&root=gcc&view=rev
Log:
PR c++/57082 - new X{} and private destructor.

build_new_1 already passes tf_no_cleanup to build_value_init, but in this
testcase we end up calling build_value_init by way of
build_special_member_call, so we need to pass it to that function as well.

* init.c (build_new_1): Also pass tf_no_cleanup to
build_special_member_call.

Added:
branches/gcc-9-branch/gcc/testsuite/g++.dg/cpp0x/initlist-new2.C
Modified:
branches/gcc-9-branch/gcc/cp/ChangeLog
branches/gcc-9-branch/gcc/cp/init.c

[Bug c++/57082] brace initialization requires public destructor

2019-12-11 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57082

--- Comment #6 from Jason Merrill  ---
Author: jason
Date: Wed Dec 11 16:51:09 2019
New Revision: 279236

URL: https://gcc.gnu.org/viewcvs?rev=279236&root=gcc&view=rev
Log:
PR c++/57082 - new X{} and private destructor.

build_new_1 already passes tf_no_cleanup to build_value_init, but in this
testcase we end up calling build_value_init by way of
build_special_member_call, so we need to pass it to that function as well.

* init.c (build_new_1): Also pass tf_no_cleanup to
build_special_member_call.

Added:
trunk/gcc/testsuite/g++.dg/cpp0x/initlist-new2.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/init.c

[Bug c++/57082] brace initialization requires public destructor

2019-12-10 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57082

Jason Merrill  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |jason at gcc dot gnu.org

[Bug c++/57082] brace initialization requires public destructor

2016-11-22 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57082

--- Comment #5 from Jonathan Wakely  ---
(In reply to lucdanton from comment #1)
> Using a very similar testcase I bisected the issue to r239783:
> 
> //--
> struct no_destr {
> no_destr() = default;
> protected:
> ~no_destr() = default;
> };
> 
> int main()
> {
> // error: 'no_destr::~no_destr()' is protected within this context
> new no_destr {};
> }

And that doesn't depend on brace-init either, so is a different issue. I've
reported it as Bug 78469

[Bug c++/57082] brace initialization requires public destructor

2016-11-22 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57082

--- Comment #4 from Jonathan Wakely  ---
(In reply to Stephane Kaloustian from comment #3)
> In my understanding, this is related to the creation of a copy. 
> Using g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4):

No, that's a completely different issue, and was fixed for GCC 4.9.0, see Bug
50025.

[Bug c++/57082] brace initialization requires public destructor

2016-11-22 Thread stephane.kaloust...@optimo-medical.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57082

Stephane Kaloustian  changed:

   What|Removed |Added

 CC||stephane.kaloustian@optimo-
   ||medical.com

--- Comment #3 from Stephane Kaloustian 
 ---
In my understanding, this is related to the creation of a copy. 
Using g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4):

struct B{
B(){}
~B(){}
B(const B&) = delete;
};

int main (int argc, char** argv)
{
B myB;
const B & bref1 = myB; // OK
const B & bref2(myB);  // OK
const B & bref3{myB};  // ERROR
return 0;
}

delref.cpp: In function ‘int main(int, char**)’:
delref.cpp:14:24: error: use of deleted function ‘B::B(const B&)’
 const B & bref3{myB};
^
delref.cpp:5:5: error: declared here
 B(const B&) = delete;
 ^

[Bug c++/57082] brace initialization requires public destructor

2016-10-28 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57082

Jonathan Wakely  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-10-28
 CC||jason at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #2 from Jonathan Wakely  ---
Your example failing is a regression in trunk, but my example fails long before
r239783 was committed.

[Bug c++/57082] brace initialization requires public destructor

2016-10-27 Thread lucdanton at free dot fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57082

lucdanton at free dot fr changed:

   What|Removed |Added

 CC||lucdanton at free dot fr

--- Comment #1 from lucdanton at free dot fr ---
Using a very similar testcase I bisected the issue to r239783:

//--
struct no_destr {
no_destr() = default;
protected:
~no_destr() = default;
};

int main()
{
// error: 'no_destr::~no_destr()' is protected within this context
new no_destr {};
}