egcs requires irrelevant function call in order to resolve operator+

Corey Kosak kosak@cs.cmu.edu
Mon Dec 8 04:27:00 GMT 1997


Sorry for the resend, but my previous message doesn't appear to have made it
to the list.


Check this out:


% g++ -v
Reading specs from /usr2/yloco/lib/gcc-lib/alpha-dec-osf3.2/egcs-2.90.20/specs
gcc version egcs-2.90.20 971201 (gcc2-970802 experimental)

% cat is_this_a_bug.cc
struct A {};

template <class T>
void operator+ (A &i, T &b) {}

template<class T>
void func (A &a, T &b) {}

int main()
{
  A a;

#if STRANGE
  func(a, "egcs");
#endif
  a+"egcs";
}

% g++ is_this_a_bug.cc
is_this_a_bug.cc: In function `int main()':
is_this_a_bug.cc:16: no match for `A & + char[5]'
is_this_a_bug.cc:4: candidates are: operator +<char[5]>(A &, char (&)[5])

% g++ -DSTRANGE is_this_a_bug.cc
% 



More information about the Gcc-bugs mailing list