* g++ template instantiation warnings?
@ 1997-12-16 0:28 Brendt Wohlberg
1997-12-16 10:08 ` Alexandre Oliva
0 siblings, 1 reply; 2+ messages in thread
From: Brendt Wohlberg @ 1997-12-16 0:28 UTC (permalink / raw)
To: egcs
Is there a a -W option, or some other method, of switching off the warnings:
warning: friend declaration `void swap(class A<T> &, class A<T> &)'
warning: will not be treated as a template instantiation
warning: unless you compile with -fguiding-decls
warning: or add <> after the function name
for friend declarations *without* turning them into template instantiations
(when compiling with -fno-implicit-templates, for example)?
--
Brendt Wohlberg E-mail: brendt@dip.ee.uct.ac.za
Department of Electrical Engineering Phone : +27 21 650 3466
University of Cape Town Fax : +27 21 650 3465
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: g++ template instantiation warnings?
1997-12-16 0:28 g++ template instantiation warnings? Brendt Wohlberg
@ 1997-12-16 10:08 ` Alexandre Oliva
0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Oliva @ 1997-12-16 10:08 UTC (permalink / raw)
To: egcs
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1997-12-16 10:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-12-16 0:28 g++ template instantiation warnings? Brendt Wohlberg
1997-12-16 10:08 ` Alexandre Oliva
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).