Boost logo

Boost Users :

Subject: Re: [Boost-users] [Proto] POD expression can't be used in std::vector
From: Eric Niebler (eric_at_[hidden])
Date: 2008-11-23 17:44:47


Hartmut Kaiser wrote:
>> You should, if you (or someone) can confirm it happens on Intel 11.0
>> also. Here is a simple repro:
>>
>> namespace N
>> {
>> struct S {};
>> template<class T, class U>
>> void operator+(T const &, U const &) {}
>> }
>>
>> template<class T> struct X {};
>> struct Y : X<N::S> {};
>>
>> int main()
>> {
>> Y y;
>> y+y;
>> }
>>
>> The above code compiles with gcc but doesn't with Intel 10.1
>
> Intel 11.0 (Windows):
>
> t.cpp
> t.cpp(13): error: no operator "+" matches these operands
> operand types are: Y + Y
> y+y;
> ^

Thanks Hartmut. I checked the standard, and this appears to be correct
behavior. That means that gcc's ADL is overeager. I've filed the bug here:

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

FWIW, MSVC also rejects this code.

Thanks,

-- 
Eric Niebler
BoostPro Computing
http://www.boostpro.com

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net