This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/70077] noexcept, inheriting constructors and the invalid use of an incomplete type that is actually complete
- From: "michele.caini at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 04 Mar 2016 09:17:12 +0000
- Subject: [Bug c++/70077] noexcept, inheriting constructors and the invalid use of an incomplete type that is actually complete
- Auto-submitted: auto-generated
- References: <bug-70077-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70077
--- Comment #2 from Michele Caini <michele.caini at gmail dot com> ---
(In reply to Michele Caini from comment #0)
> 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.
Sorry, the example at http://coliru.stacked-crooked.com/a/fdbd0c1c70e74f64
contains an error and does not make much sense.
Please, consider the other link:
http://coliru.stacked-crooked.com/a/81552252ead0d349