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

            Bug ID: 106812
           Summary: Throwing a non-copyable exception
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jens.maurer at gmx dot net
  Target Milestone: ---

gcc accepts the following program:

struct S
{
  S() = default;
  S(const S&) = delete;
  // int x = 0;  // #3
};

int main()
{
  try {
    throw S();         // #1
  } catch (S s) {      // #2
    return 1;
  }
}

but it is ill-formed at #1 according to [except.throw] p5.

Curiously, if line #3 is added, gcc flags an error at #2 (but not at #1).

Reply via email to