Opened 15 years ago
Closed 15 years ago
#1216 closed Bugs (fixed)
problems compiling template class using is_class and is_arithmetic
Reported by: | sheff | Owned by: | John Maddock |
---|---|---|---|
Milestone: | To Be Determined | Component: | type_traits |
Version: | Boost 1.34.1 | Severity: | Problem |
Keywords: | Cc: |
Description
Consider this code:
class C { public: template <typename T> typename boost::enable_if_c<boost::is_class<T>::value, void>::type f(T& t) { } template <typename T> typename boost::enable_if_c<boost::is_arithmetic<T>::value, void>::type f(T& t) { } }; void main() { C c; }
it compiles without fault, but the following code:
class A {}; template <class T1> class B : public T1 { public: template <typename T2> typename boost::enable_if_c<boost::is_class<T2>::value, void>::type f(T2& t) { } template <typename T2> typename boost::enable_if_c<boost::is_arithmetic<T2>::value, void>::type f(T2& t) { } }; void main() { B<A> a; }
fails to compile
Note:
See TracTickets
for help on using tickets.
That needs to be:
template <class T1> class B : public T1 { public:
};