This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/26267] New: template function implicity instatiated
- From: "eduffy at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 Feb 2006 20:20:23 -0000
- Subject: [Bug c++/26267] New: template function implicity instatiated
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
While compiling:
template<typename T>
struct Type2Type {
typedef T Type;
};
template<class T>
inline void foo(Type2Type<T> const&) {
int x = NOT_HERE;
}
int main(int, char *) {
// std::cout << "Hello world!" << std::endl;
}
g++ gives an error about NOT_HERE being declared. Rightly so, but the function
`foo' is never called or explicity instantiated, so `foo' should never be
compiled.
>From "14.7.1 Implicit instantiation" of the ISO C++ standard:
9. An implementation shall not implicitly instantiate a function template,
a member template, a non-virtual member function, a member class or a
static data member of a class template that does not require instantia-
tion.
--
Summary: template function implicity instatiated
Product: gcc
Version: 4.0.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: eduffy at gmail dot com
GCC host triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26267