Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost.Function compile error
From: gast128 (gast128_at_[hidden])
Date: 2013-03-07 06:19:14


On 3/7/2013 10:29 AM, Igor R wrote:
>> Thx, I was aware of Scott Meyers item (stumbled upon that already in the
>> past), but here it can't be seen as a function since 'id' is not a type but
>> a variable. The compiler also see 'id' not as a function but as a variable
>> declaration of 'Bla'. Is that because u can also declare a variable like
>> this:
>>
>> int (i) = 0;
>>
>> and why is that allowed?
>
>
> It's because the compiler threats
> Bla(id);
> as:
> Bla id;
> as you can see from the errors (MSVC10):
> error C2371: 'id' : redefinition; different basic types
> error C2512: 'Bla' : no appropriate default constructor available

Yes but which (obscure) c++ rule allows this. My day to day c++
knowledge says that () is only used for macro invocations, function
declarations, function call's and cast operators and none of them seems
to be applicable here.


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