This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c++/10147: Confusing error message for invalid template function argument


>Number:         10147
>Category:       c++
>Synopsis:       Confusing error message for invalid template function argument
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Mar 19 09:36:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Lars Albertsson
>Release:        3.2.2
>Organization:
>Environment:
snaga:tmp> uname -a
Linux snaga.sics.se 2.4.19 #7 Fri Nov 29 15:22:22 CET 2002 i686 i686 i386 GNU/Linux

snaga:tmp> cat /etc/redhat-release 
Red Hat Linux release 8.0 (Psyche)
>Description:
snaga:tmp> cat bug.ii 
namespace N1
{

typedef long A;

struct B
{
  virtual A a() const;
};

struct D : public B
{
  A a() const;
};

}

N1::D d();

namespace N2
{

struct A {};

template < class T > T tf(const T &)
{
  return T();
}

void f(const N1::B & b)
{
 tf< A >(b.a());
}

}

void f2()
{
  N2::f(d());
}

snaga:tmp> /opt/gcc-3.2.2/bin/g++ -c bug.ii 
bug.ii: In function `void N2::f(const N1::B&)':
bug.ii:32: could not convert `(**(+b)->N1::B::_vptr.B)((+b))' to `const N2::A&'
bug.ii:26: in passing argument 1 of `T N2::tf(const T&) [with T = N2::A]'

snaga:tmp> /opt/gcc-3.2.2/bin/g++ -v 
Reading specs from /opt/gcc-3.2.2/lib/gcc-lib/i686-pc-linux-gnu/3.2.2/specs
Configured with: /tmp/post_install/gcc-3.2.2/configure --enable-languages=c,c++ --prefix=/opt/gcc-3.2.2
Thread model: posix
gcc version 3.2.2
>How-To-Repeat:

>Fix:

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]