c++/7100: Class constructors considered during argument-dependent lookup

david.abrahams@rcn.com david.abrahams@rcn.com
Fri Jun 21 13:28:00 GMT 2002


>Number:         7100
>Category:       c++
>Synopsis:       Class constructors considered during argument-dependent lookup
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jun 21 10:46:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     david.abrahams@rcn.com
>Release:        3.1
>Organization:
>Environment:
cygwin
>Description:
The following should compile, but fails instead with:

foo.cpp: In function `int X::f(T) [with T = Z::S]':
foo.cpp:33:   instantiated from here
foo.cpp:3: `struct Z::object' is not a function,
foo.cpp:16:   conflict with `template<class T> X::o X::object(const T&)'
foo.cpp:26:   in call to `object'
>How-To-Repeat:
namespace Z
{
   struct object {
       object( char*);
   };
   struct S {};
}

namespace X
{
  struct o {};

  template <class T>
  o object(T const&);
  
  template <class T>
  void g(T const&);

  int g(o const&);

 template <class T>
 int f(T  x)
 {
     return g(object(x));
 }
}

int main()
{
   X::f(Z::S());
   return 0;
}

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list