[Bug c++/80683] Exceptions don't propagate through default member initializer

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

Andrew Pinski  changed:

   What|Removed |Added

 Resolution|--- |DUPLICATE
 Status|NEW |RESOLVED
 Depends on||85363

--- Comment #6 from Andrew Pinski  ---
This is a dup of bug 85363 which was fixed in GCC 9+.

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


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85363
[Bug 85363] Throwing exception from member constructor (brace initializer vs
initializer list)

[Bug c++/80683] Exceptions don't propagate through default member initializer

2017-05-11 Thread ryxi at stu dot xidian.edu.cn
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80683

--- Comment #5 from Xi Ruoyao  ---
The issue is in cp/method.c:

  /* If that user-written default constructor would satisfy the
 requirements of a constexpr constructor (7.1.5), the
 implicitly-defined default constructor is constexpr.

 The implicitly-defined copy/move assignment operator is constexpr if
  - X is a literal type, and
  - the assignment operator selected to copy/move each direct base class
subobject is a constexpr function, and
  - for each non-static data member of X that is of class type (or array
thereof), the assignment operator selected to copy/move that
member is a constexpr function.  */
  if (constexpr_p)
*constexpr_p = ctor_p || (assign_p && cxx_dialect >= cxx14);

But if we have default member initializers, the implicitly-defined default
constructor can not be constexpr.  We have to check it.

[Bug c++/80683] Exceptions don't propagate through default member initializer

2017-05-11 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80683

Jonathan Wakely  changed:

   What|Removed |Added

 Status|RESOLVED|NEW
   Last reconfirmed||2017-05-11
 Resolution|DUPLICATE   |---
 Ever confirmed|0   |1

--- Comment #4 from Jonathan Wakely  ---
Let's reopen this one then.

[Bug c++/80683] Exceptions don't propagate through default member initializer

2017-05-10 Thread ryxi at stu dot xidian.edu.cn
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80683

--- Comment #3 from Xi Ruoyao  ---
For debug purpose, compiled this code in C++98 mode
(non-static data member initializers is a GNU extension in C++98 and would
be warned).  The result is still buggy.  Defaulted B::B() is marked noexcept.

[Bug c++/80683] Exceptions don't propagate through default member initializer

2017-05-10 Thread ryxi at stu dot xidian.edu.cn
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80683

--- Comment #2 from Xi Ruoyao  ---
I don't think it's PR66139.

In PR66139, the exception is caught, but some destructors aren't called.

In this PR, the exception is not caught at all.

For this PR, the problem is:

1) GCC created "constexpr B::B()" and call A::A() in it.
2) In optimization, GCC think a constexpr doesn't throw. So the EH code is
   optimized away.
3) But actually B::B() throws and shouldn't be a constexpr.

I'll read the standard and find out what should we do for this.

[Bug c++/80683] Exceptions don't propagate through default member initializer

2017-05-10 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80683

Markus Trippelsdorf  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 CC||trippels at gcc dot gnu.org
 Resolution|--- |DUPLICATE

--- Comment #1 from Markus Trippelsdorf  ---
dup.

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