New 3.4.4 all-mighty gcc fails on this one
Code:
#include <iostream>
class A{
public:
A(){}
};
A& operator+=(A& a,char b){return a;}
template<class W> A operator+ (const A&,const W& b){ return A(a)+=b; }
int main(){
A a;
A b = a+'h';
return 0;
}
Code:
$ make
g++ -Wall -c ./main.cpp -o obj/./main.o
./main.cpp: In function `A operator+(const A&, const W&) [with W = char]':
./main.cpp:12: instantiated from here
./main.cpp:8: error: no match for 'operator+=' in 'A(((const A&)(+a))) += b'
./main.cpp:7: note: candidates are: A& operator+=(A&, char)
make: *** [obj/./main.o] Error 1
Yet, this source compiles great on MSVC++ 6 and 7...
I'm thinking in submiting this code to gcc bugzilla