[wwwdocs] Add a case to porting_to + a question wrt validity of another one
Marek Polacek
polacek@redhat.com
Mon Feb 6 17:13:00 GMT 2017
This patch adds a description of something I noticed while doing the
Fedora mass rebuild. Do we want to say more about the invalidity of
the incomplete type case?
Furthermore I noticed that the testcase below doesn't compile anymore since
r240874; Nathan, is that desirable?
class C {
public:
virtual ~C() noexcept(false);
};
class A : virtual C {
virtual C m_fn1() = 0;
};
class B : A {};
s.cc:8:7: error: looser throw specifier for âvirtual B::~B() noexcept (false)â
class B : A {};
^
s.cc:5:7: error: overriding âvirtual A::~A() noexceptâ
class A : virtual C {
^
If it's desirable that g++ rejects this, we should say something about it in
porting_to. Any ideas what that might be?
Thanks,
Index: gcc-7/porting_to.html
===================================================================
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-7/porting_to.html,v
retrieving revision 1.3
diff -u -r1.3 porting_to.html
--- gcc-7/porting_to.html 3 Feb 2017 07:55:27 -0000 1.3
+++ gcc-7/porting_to.html 6 Feb 2017 17:08:44 -0000
@@ -33,6 +33,23 @@
<h2 id="cxx">C++ language issues</h2>
+<h3 id="incomplete-type">Invalid use of incomplete type</h3>
+
+<p>
+GCC 7 no longer accepts ill-formed code involving use of an incomplete type:
+<pre><code>
+namespace N {
+class C;
+class A {
+ C fn1();
+};
+template <typename> class B : A {
+ void fn2() { fn1().x; }
+};
+}
+</code></pre>
+</p>
+
<h3 id="conversion-op-mangling">Mangling change for conversion operators</h3>
<p>
Marek
More information about the Gcc-patches
mailing list