This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
[3.4] Incomplete types and template definitions
- From: Florian Weimer <fw at deneb dot enyo dot de>
- To: gcc at gnu dot org
- Date: Thu, 18 Sep 2003 15:58:28 +0200
- Subject: [3.4] Incomplete types and template definitions
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>