[Bug c++/34886] New: Strangeness of name lookup in template function
rvovsd at mail dot ru
gcc-bugzilla@gcc.gnu.org
Sun Jan 20 16:44:00 GMT 2008
On compiling that code:
--- begin code ---
class Y {};
void f(Y*) { } // line 3. If comment - all ok
template < typename T>
void sel(T* a) { f(a); } //line 6
void f(void*) {}
int main(int argc, char **argv)
{
sel((void*)0); //line 12
}
--- end code ---
Ãppears error:
../main.cpp: In function Âvoid sel(T*) [with T = void]Â:
../main.cpp:12: instantiated from here
../main.cpp:6: error: invalid conversion from Âvoid*Â to ÂY*Â
../main.cpp:6: error: initializing argument 1 of Âvoid f(Y*)Â
If comment line 3, then work.
Also work, if line 3 move after line 6.
If functions f(Y*), f(void*) and sel(T*) placed in different header files, then
arise dependency on order including headers.
--
Summary: Strangeness of name lookup in template function
Product: gcc
Version: 4.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rvovsd at mail dot ru
GCC host triplet: openSuse 10.3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34886
More information about the Gcc-bugs
mailing list