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

            Bug ID: 70375
           Summary: catch by value still allows explicit constructor
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: barry.revzin at gmail dot com
  Target Milestone: ---

gcc 5.3.0 compiles this code:

struct B {
    B() = default;
    explicit B(B const& ) { }
};

struct D : B { };

int main() {
    try {
        throw D{};
    }
    catch(B ) {
    }
}

but [except.handle]/15 says that the handler variable should be
copy-initialized from the base class subobject of the exception object, which
should be disallowed since the copy constructor is marked explicit.

Reply via email to