[Bug c++/39770] New: Function template can find a struct in same namespace/other namespace but not inside a function

2009-04-14 Thread mlybbert at users dot sourceforge dot net
The following code does not compile ( error: no matching function for call to
`::A::print(main()::B&) ):

#include 

namespace {
struct A {
template void print(C c)
{
c.print();
}
};

}

int main()
{
A a;
struct B {
void print()
{
std::cout << "whee!";
}
};
B b;
a.print(b);
}

However, defining B in the same namespace as A, in a different namespace, or
even in the global namespace compiles and works as expected.  I don't know the
standard well enough to say if this is correct behavior, but it seems like an
odd rule.


-- 
   Summary: Function template can find a struct in same
namespace/other namespace but not inside a function
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mlybbert at users dot sourceforge dot net


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39770



[Bug c++/39770] Function template can find a struct in same namespace/other namespace but not inside a function

2009-04-14 Thread mlybbert at users dot sourceforge dot net


--- Comment #3 from mlybbert at users dot sourceforge dot net  2009-04-14 
21:56 ---
Thank you.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39770