ICE compiling template code



Hi All,

Here is some code from another thread in 'comp.lang.c++'. I get ICE on the line that contains 'friend' keyword.

void Function();
int main() {
Function(); // This does not work
}

#include <stdio.h>

template <typename T>
class Test
{
public:
friend void Function() { printf("Function()"); }
};

template class Test<int>; // explicit instantiation

(compiler file 'msc1.cpp', line 1411)

Any clues?

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
.



Relevant Pages

  • Newbie : friend function problem
    ... The problem relates to a Class Time and within it I have defined a friend ... When I program the function inline within the class definition everthing ... int minutes; ... void AddMin; ...
    (comp.lang.cpp)
  • Newbie : Problem with a friend function
    ... The problem relates to a Class Time and within it I have defined a friend ... When I program the function inline within the class definition everthing ... int minutes; ... void AddMin; ...
    (alt.comp.lang.learn.c-cpp)
  • Re: Please Comment on this Integer to String Code.
    ... representation from base -32 to 32(32 since strtoul takes 32). ... One friend points out that it takes upto 36. ... void printBase ... int main ...
    (comp.lang.c)
  • Re: Obfuscation devices (was Name Space Pollution: using macros ...)
    ... >> #define'ing a keyword is portable as long as it is done after ... the "int" macro, it would become: ... value 0 to void *, and is no less a valid definition of NULL if "int" ... Can an implementation legally define macros that rely on int really ...
    (comp.lang.c)
  • Re: Why wont this compile
    ... Can someone explain why the following code won't compile in both VC7 and VC8 ... You haven't made the function a friend. ... friend void Func; ... template void Func; is a friend, not the function template void Func; which is presumably closer to what is desired. ...
    (microsoft.public.vc.language)