[intrusive] boost/intrusive/detail/has_member_function_callable_with.hpp: inheriting from a const class

Hello, I tried to use a boost::container::vector with a Texas Instruments compiler, and I got an error pointing to line 88 of <boost/intrusive/detail/has_member_function_callable_with.hpp> "Invalid base class", with Type=const std::allocator<something>" Here's the context: template <typename Type> class BOOST_PP_CAT(has_member_function_named_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME) { struct BaseMixin { void BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME(); }; struct Base : public Type, public BaseMixin { Base(); }; // <-- line 88 The problem seems to be the constness of Type. Here's a simplified example: struct X {}; template < class T > struct Y : T { Y() {} }; int main() { Y<const X> y; } The above example compiles fine with Linux gcc version 4.5.4, and MinGW 4.5.0, but fails with my TI compiler. My question is: is this a bug of the TI compiler, or is that compiler actually right about this, and should we fix this in Boost? For now, my workaround is: struct Base : public ::boost::remove_cv<Type>::type, public BaseMixin { Base(); }; // <-- line 88 Regards, Kris

2012/12/2 Krzysztof Czainski <1czajnik@gmail.com>
Hello,
I tried to use a boost::container::vector with a Texas Instruments compiler, and I got an error pointing to line 88 of <boost/intrusive/detail/has_member_function_callable_with.hpp> "Invalid base class", with Type=const std::allocator<something>"
Here's the context:
template <typename Type> class BOOST_PP_CAT(has_member_function_named_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME) { struct BaseMixin { void BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME(); };
struct Base : public Type, public BaseMixin { Base(); }; // <-- line 88
The problem seems to be the constness of Type. Here's a simplified example:
struct X {};
template < class T > struct Y : T { Y() {} };
int main() { Y<const X> y; }
The above example compiles fine with Linux gcc version 4.5.4, and MinGW 4.5.0, but fails with my TI compiler.
My question is: is this a bug of the TI compiler, or is that compiler actually right about this, and should we fix this in Boost? For now, my workaround is:
struct Base : public ::boost::remove_cv<Type>::type, public BaseMixin { Base(); }; // <-- line 88
Regards, Kris
Hi, Since there is no response, and this is used by Boost.Container, I added the [container] tag to the subject. Any opinions about which compiler is right about this: is GCC too permissive, or is TI buggy in this respect? Regards, Kris

On Thu, Dec 13, 2012 at 9:26 AM, Krzysztof Czainski <1czajnik@gmail.com>wrote:
2012/12/2 Krzysztof Czainski <1czajnik@gmail.com>
Hello,
I tried to use a boost::container::vector with a Texas Instruments compiler, and I got an error pointing to line 88 of <boost/intrusive/detail/has_member_function_callable_with.hpp> "Invalid base class", with Type=const std::allocator<something>"
Here's the context:
template <typename Type> class BOOST_PP_CAT(has_member_function_named_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME) { struct BaseMixin { void BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME(); };
struct Base : public Type, public BaseMixin { Base(); }; // <-- line 88
The problem seems to be the constness of Type. Here's a simplified example:
struct X {};
template < class T > struct Y : T { Y() {} };
int main() { Y<const X> y; }
The above example compiles fine with Linux gcc version 4.5.4, and MinGW 4.5.0, but fails with my TI compiler.
My question is: is this a bug of the TI compiler, or is that compiler actually right about this, and should we fix this in Boost? For now, my workaround is:
struct Base : public ::boost::remove_cv<Type>::type, public BaseMixin { Base(); }; // <-- line 88
Regards, Kris
Hi,
Since there is no response, and this is used by Boost.Container, I added the [container] tag to the subject.
Any opinions about which compiler is right about this: is GCC too permissive, or is TI buggy in this respect?
FWIW, I believe the same compiler error pops up with at least some version of the IBM compiler. I haven't received verification yet on whether the remove_cv addition addresses that compiler error as well. Also, since your asked for an opinion, my opinion is to side with GCC over TI :) - Jeff

El 13/12/2012 18:26, Krzysztof Czainski escribió:
2012/12/2 Krzysztof Czainski <1czajnik@gmail.com>
The above example compiles fine with Linux gcc version 4.5.4, and MinGW 4.5.0, but fails with my TI compiler.
If that's the only error that avoids using Booost.Container with TI compiler, please fill a ticket so that your workaround is added in Intrusive. Best, Ion

2012/12/14 Ion Gaztañaga <igaztanaga@gmail.com>
2012/12/2 Krzysztof Czainski <1czajnik@gmail.com>
The above example compiles fine with Linux gcc version 4.5.4, and MinGW 4.5.0, but fails with my TI compiler.
If that's the only error that avoids using Booost.Container with TI compiler, please fill a ticket so that your workaround is added in Intrusive.
Best,
Ion
This wasn't the only error. There was another one. I finally managed to work around it, and it is entirely a TI compiler bug, which TI intends to fix. So now I can say, that this is likely to be the only error in the near future ;-) Ticket 7815 created. Cheers, Kris
participants (3)
-
Ion Gaztañaga
-
Jeffrey Lee Hellrung, Jr.
-
Krzysztof Czainski