[3.4] Incomplete types and template definitions

Florian Weimer fw@deneb.enyo.de
Thu Sep 18 14:40:00 GMT 2003


Compiler behavior in this area changed, and this should be documented.
(The last Xerces 2.3.0 exhibits this change, for example.)

Is this patch okay?  (I'm not too familiar with the correct C++
terminology.)  Shall I quote the GCC error message?  (The other
examples don't do this.)

The example below results in duplicate error messages.  I'm going to
file a separate bug report for that (if it's not known so far).

--- changes.html.~1.47.~	2003-09-11 21:31:06.000000000 +0200
+++ changes.html	2003-09-18 15:52:27.000000000 +0200
@@ -122,6 +122,21 @@
 	  this->g ();
 	}</pre></li>
 
+    <li>Also in a template definition, GCC used to accept certain
+    references to incomplete types, as long as the type is not
+    incomplete at the time of template instantiation.  For example,
+    the following code was accepted:
+        <pre>
+         struct Foo;
+         template <class X> struct Bar {
+           void bar(Foo, struct Foo* baz)
+           {
+             baz->foo();
+           }
+         };
+         struct Foo { void foo(); };
+         Bar<int> bar;</pre></li>
+
     <li>The "named return value" and "implicit typename"
 	extensions have been removed.</li>
 	    



More information about the Gcc mailing list