public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/26267] New: template function implicity instatiated
@ 2006-02-13 20:20 eduffy at gmail dot com
2006-02-13 20:24 ` [Bug c++/26267] " pinskia at gcc dot gnu dot org
2006-02-13 20:27 ` pinskia at gcc dot gnu dot org
0 siblings, 2 replies; 3+ messages in thread
From: eduffy at gmail dot com @ 2006-02-13 20:20 UTC (permalink / raw)
To: gcc-bugs
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/26267] template function implicity instatiated
2006-02-13 20:20 [Bug c++/26267] New: template function implicity instatiated eduffy at gmail dot com
@ 2006-02-13 20:24 ` pinskia at gcc dot gnu dot org
2006-02-13 20:27 ` pinskia at gcc dot gnu dot org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-13 20:24 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2006-02-13 20:24 -------
This has nothing to do with implicity instatiating the template function.
NOT_HERE is not dependent so it is looked up as the template function is parsed
and not at instatiation time.
This is not a bug and this behavior is required by the standard by the
non-dependent namelookup.
You were looking into the wrong section (I don't have the standard in front of
me but IIRC the section is named template lookup rules).
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26267
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/26267] template function implicity instatiated
2006-02-13 20:20 [Bug c++/26267] New: template function implicity instatiated eduffy at gmail dot com
2006-02-13 20:24 ` [Bug c++/26267] " pinskia at gcc dot gnu dot org
@ 2006-02-13 20:27 ` pinskia at gcc dot gnu dot org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-13 20:27 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pinskia at gcc dot gnu dot org 2006-02-13 20:27 -------
*** Bug 26268 has been marked as a duplicate of this bug. ***
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26267
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-02-13 20:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-13 20:20 [Bug c++/26267] New: template function implicity instatiated eduffy at gmail dot com
2006-02-13 20:24 ` [Bug c++/26267] " pinskia at gcc dot gnu dot org
2006-02-13 20:27 ` pinskia at gcc dot gnu dot org
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).