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

michele.caini at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri Mar 4 08:52:00 GMT 2016


--- Comment #1 from Michele Caini <michele.caini at gmail dot com> ---
Actually, the same example does not compile on the web compiler previously
See http://coliru.stacked-crooked.com/a/81552252ead0d349 for further details.
The error is a bit more meaningful:

g++ -std=c++14 -O2 -Wall -pedantic -pthread main.cpp && ./a.out
main.cpp:8:31: error: invalid use of incomplete type 'struct D'
     D() noexcept(noexcept(D{42})): B{42} { }
main.cpp:6:8: note: definition of 'struct D' is not complete until the closing
 struct D: public B {

Still, is it valid code? It looks valid to me, but it could be a corner case of
the language, not sure about that honestly.

More information about the Gcc-bugs mailing list