This is the mail archive of the gcc@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] |
Brendt Wohlberg writes:
> warning: friend declaration `void swap(class A<T> &, class A<T> &)'
> warning: will not be treated as a template instantiation
> for friend declarations *without* turning them into template instantiations
> (when compiling with -fno-implicit-templates, for example)?
In fact, the error message has nothing to do with actually generating
code for template instantiations, it has to do with compiling that
declaration as referring to a template function specialization or a
non-template function. If you don't add angle brackets, you won't be
referring to a template specialization:
void foo(int);
template <typename T> void foo(T);
class bar {
friend void foo(int); // refers to the non-template version
friend void foo<>(int); // refers to the template specialization
};
Maybe the error message should be changed to say `template
specialization' instead of `template instantiation'.
--
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |