This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/15538] Message does not indicate that we are trying to look into an incomplete type


------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]