This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/70077] noexcept, inheriting constructors and the invalid use of an incomplete type that is actually complete


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]