This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/34870] New: template not instantiated for argument-dependent lookup
- From: "dragan at plusplus dot co dot yu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Jan 2008 11:36:21 -0000
- Subject: [Bug c++/34870] New: template not instantiated for argument-dependent lookup
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
This code should be legal:
template <typename T>
struct Foo
{
template <typename Z>
friend void func(const Foo &) {}
};
void check(const Foo<int> & x)
{
// Foo<int> weird; // uncomment this line and all works
func<int>(x); // <-- GCC issues an ERROR
}
After a brief discussion on gcc@gcc.gnu.org, it has been concluded that this
sample code should work. Apparently, 'func' should have been found by
argument-dependent lookup, instantiating 'Foo<int>' in the process.
Here are links to backup these claims, as specified in the discussion by people
involved:
- C++ Standard
- 3.4.2 [basic.lookup.koenig]
- 14.6.5 [temp.inject]
- 7.3.1.2 [namespace.memdef] p3
- Vandevoorde and Josuttis' C++ Templates, section 9.2.2
- http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#34
(gcc@gcc.gnu.org thread 'A simple sample code involving templates, friends and
lookup')
--
Summary: template not instantiated for argument-dependent lookup
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dragan at plusplus dot co dot yu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34870