[Bug c++/495] ICE in in lookup_template_class, at cp/pt.c:3961

bangerth at dealii dot org gcc-bugzilla@gcc.gnu.org
Mon Aug 18 17:00:00 GMT 2003


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=495


bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lerdsuwa at gcc dot gnu dot
                   |                            |org
           Keywords|ice-on-valid-code           |


------- Additional Comments From bangerth at dealii dot org  2003-08-18 17:00 -------
Mu understanding these days is that my code is illegal: struct Y needs to be forward 
declared before we can make it a friend in X. If one does that, the code compiles in both 
variants. 
 
I guess the problem here is that when one forgets doing so, the error message is mostly 
unintelligible: for the f(Y) variant, we get 
  x.cc:9: error: invalid use of undefined type `struct Y<dim>' 
  x.cc:6: error: declaration of `struct Y<dim>' 
  x.cc:9: error: missing template arguments 
How can the type be undefined if it is declared in the line that is given correctly? I 
imagine that this has to do with a tentative declaration when seeing the (invalid) friend 
declaration that is not properly overwritten by the real declaration found later. 
 
Kriang, you are the expert in friendship. Can you say whether the code is really 
invalid (and then remove the last keyword and replace it by "diagnostic")? And do you 
have an idea what might cause the cryptic error message? 
 
W.



More information about the Gcc-bugs mailing list