This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/30766] New: Template functions now use declaration scope instead of call scope
- From: "9ugsa9j02 at sneakemail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 11 Feb 2007 20:02:13 -0000
- Subject: [Bug c++/30766] New: Template functions now use declaration scope instead of call scope
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
-------------------------------------------------------------
int overridable (int v) { return (v); }
template <typename T>
int call_override (const T& v) { return (overridable (v)); }
int overridable (float) { return (1); }
int main (void)
{
return (call_override (0.0f));
}
-------------------------------------------------------------
The above code compiles fine with 4.0.2, but does not work with 4.2.0 20070207,
where call_override does not see the float version of overridable even though
it is available at the time of instantiation.
I use this method in my library to allow overriding a function for
user-specific types.
--
Summary: Template functions now use declaration scope instead of
call scope
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: 9ugsa9j02 at sneakemail dot com
GCC build triplet: x86_64-pc-linux-gnu
GCC host triplet: x86_64-pc-linux-gnu
GCC target triplet: x86_64-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30766