This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/15538] Message does not indicate that we are trying to look into an incomplete type
- From: "bangerth at dealii dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 May 2004 14:07:46 -0000
- Subject: [Bug c++/15538] Message does not indicate that we are trying to look into an incomplete type
- References: <20040519095559.15538.igodard@pacbell.net>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From bangerth at dealii dot org 2004-05-19 14:07 -------
The problem is actually simpler:
---------------
template <typename D>
struct A { typename D::Q r;};
template<typename G>
struct H : A<H<G> > { typedef G* Q; };
H<bool> h;
---------------
While you can pass the incomplete type H<G> as a template argument to
the base class, you can't look into it from the base class (precisely
because it is incomplete at the time).
We get this here:
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c x.cc
x.cc: In instantiation of `A<H<bool> >':
x.cc:5: instantiated from `H<bool>'
x.cc:7: instantiated from here
x.cc:2: error: no type named `Q' in `struct H<bool>'
This is indeed not very helpful, since there _is_ a type Q in H<bool>.
While the code is invalid, we could do a better job with the diagnostic.
Here is, for example, what we get from icc:
g/x> icc -Xc -ansi -c x.cc
x.cc(2): error: incomplete type is not allowed
struct A { typename D::Q r;};
^
detected during:
instantiation of class "A<D> [with D=H<bool>]" at line 5
instantiation of class "H<G> [with G=bool]" at line 7
compilation aborted for x.cc (code 2)
W.
--
What |Removed |Added
----------------------------------------------------------------------------
Known to fail| |2.95.3 3.3.1 3.0.4 3.4.0
| |3.5.0
Summary|Fails to recognize type name|Message does not indicate
| |that we are trying to look
| |into an incomplete type
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15538