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

            Bug ID: 70077
           Summary: noexcept, inheriting constructors and the invalid use
                    of an incomplete type that is actually complete
           Product: gcc
           Version: 5.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: michele.caini at gmail dot com
  Target Milestone: ---

The following code does not compile:

struct B {
    B(int) noexcept { }
    virtual void f() = 0;
};

struct D: public B {
    using B::B;
    D() noexcept(noexcept(D{42})): B{42} { }
    void f() override { }
};

int main() {
    B *b = new D{};
}


The error output is as follows:

test.cpp:8:31: error: invalid use of incomplete type ‘struct D’
     D() noexcept(noexcept(D{42})): B{42} { }

Anyway, the type D is actually a complete type and the noexcept should work as
expected.
Other version of GCC works fine indeed, see
http://coliru.stacked-crooked.com/a/fdbd0c1c70e74f64 as an example.

Reply via email to