[Bug c++/38032] New: g++ template with overloaded function behave differently on "g++ 4.3.2" and "g++ 3.4.6"

ashutosh dot nema at nechclst dot in gcc-bugzilla@gcc.gnu.org
Thu Nov 6 13:18:00 GMT 2008


Dear All,

I am unable to understand following test case behaviour.
When i compile and execute this with g++ 3.4.6 it works fine.
But when i compile and execute this with g++ 4.3.2 it aborts.

I think the test case is OK.
But g++ 4.3.2 having bug.

Below is test case:
==========================================================

#define ieq(X,Y) if((X)!=(Y)) abort();
extern void abort ();
struct B_
{
  int i;
};
struct D_:public B_
{
};
D_ d_;
int f_ (B_ &)
{
  return 100;
}
template < class T > int g_ (T t)
{
  return f_ (d_) + f_ (t);
}
int f_ (D_ &)
{
  return 1;
}
int main (int argc, char *argv[])
{
  D_ d;
  ieq (g_ (d), 101);
  return 0;
}
==========================================================

Please help me regarding this.


-- 
           Summary: g++ template with overloaded function behave differently
                    on "g++ 4.3.2" and "g++ 3.4.6"
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ashutosh dot nema at nechclst dot in


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



More information about the Gcc-bugs mailing list