public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/34886]  New: Strangeness of name lookup in template function
@ 2008-01-20 16:44 rvovsd at mail dot ru
  2008-01-20 22:21 ` [Bug c++/34886] " pinskia at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: rvovsd at mail dot ru @ 2008-01-20 16:44 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1125 bytes --]

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-12-08 22:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-20 16:44 [Bug c++/34886] New: Strangeness of name lookup in template function rvovsd at mail dot ru
2008-01-20 22:21 ` [Bug c++/34886] " pinskia at gcc dot gnu dot org
2008-01-20 23:23 ` pinskia at gcc dot gnu dot org
2008-01-21 15:15 ` rvovsd at mail dot ru
2009-12-08 21:58 ` redi at gcc dot gnu dot org
2009-12-08 22:01 ` pinskia at gcc dot gnu dot org
2009-12-08 22:03 ` 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).