c++ - Template related ICE
- Matthew Wilson (35/35) Feb 07 2003 Walter
- Walter (3/38) Feb 07 2003 Can you give me a complete test case? Thanks, -Walter
- Matthew Wilson (4/53) Feb 08 2003 Will do
- Matthew Wilson (33/89) Feb 08 2003 Here goes
- Walter (1/1) Feb 09 2003 Thanks!
Walter Receive the following: Internal error: template 3726 --- errorlevel 1 when the operator <() for lhs = simple_string, rhs = char_type const * The actual function is defined as template< ss_typename_param_k C , ss_typename_param_k T , ss_typename_param_k A > inline ss_bool_t operator <(basic_simple_string<C, T, A> const &lhs, ss_typename_type_k basic_simple_string<C, T, A>::char_type const *rhs) { return lhs.compare(rhs) < 0; } I built in a workaround for this some months ago in a couple of other classes, and was a bit stupid in forgetting it. The workaround is: template< ss_typename_param_k C , ss_typename_param_k T , ss_typename_param_k A > inline ss_bool_t operator <(basic_simple_string<C, T, A> const &lhs, #ifdef __STLSOFT_CF_TEMPLATE_OUTOFCLASSFN_QUALIFIED_TYPE_SUPPORT ss_typename_type_k basic_simple_string<C, T, A>::char_type const *rhs) #else C const *rhs) #endif /* __STLSOFT_CF_TEMPLATE_OUTOFCLASSFN_QUALIFIED_TYPE_SUPPORT */ { return lhs.compare(rhs) < 0; } Nevertheless, this is a compiler error, so though you'd want to know (and fix) Matthew
Feb 07 2003
Can you give me a complete test case? Thanks, -Walter "Matthew Wilson" <dmd synesis.com.au> wrote in message news:b21m9f$5pj$1 digitaldaemon.com...Walter Receive the following: Internal error: template 3726 --- errorlevel 1 when the operator <() for lhs = simple_string, rhs = char_type const * The actual function is defined as template< ss_typename_param_k C , ss_typename_param_k T , ss_typename_param_k A > inline ss_bool_t operator <(basic_simple_string<C, T, A> const &lhs, ss_typename_type_k basic_simple_string<C, T, A>::char_type const *rhs) { return lhs.compare(rhs) < 0; } I built in a workaround for this some months ago in a couple of other classes, and was a bit stupid in forgetting it. The workaround is: template< ss_typename_param_k C , ss_typename_param_k T , ss_typename_param_k A > inline ss_bool_t operator <(basic_simple_string<C, T, A> const &lhs, #ifdef __STLSOFT_CF_TEMPLATE_OUTOFCLASSFN_QUALIFIED_TYPE_SUPPORT ss_typename_type_k basic_simple_string<C, T, A>::char_type const *rhs) #else C const *rhs) #endif /* __STLSOFT_CF_TEMPLATE_OUTOFCLASSFN_QUALIFIED_TYPE_SUPPORT */ { return lhs.compare(rhs) < 0; } Nevertheless, this is a compiler error, so though you'd want to know (and fix) Matthew
Feb 07 2003
Will do "Walter" <walter digitalmars.com> wrote in message news:b24fkk$1jj8$1 digitaldaemon.com...Can you give me a complete test case? Thanks, -Walter "Matthew Wilson" <dmd synesis.com.au> wrote in message news:b21m9f$5pj$1 digitaldaemon.com...(andWalter Receive the following: Internal error: template 3726 --- errorlevel 1 when the operator <() for lhs = simple_string, rhs = char_type const * The actual function is defined as template< ss_typename_param_k C , ss_typename_param_k T , ss_typename_param_k A > inline ss_bool_t operator <(basic_simple_string<C, T, A> const &lhs, ss_typename_type_k basic_simple_string<C, T, A>::char_type const *rhs) { return lhs.compare(rhs) < 0; } I built in a workaround for this some months ago in a couple of other classes, and was a bit stupid in forgetting it. The workaround is: template< ss_typename_param_k C , ss_typename_param_k T , ss_typename_param_k A > inline ss_bool_t operator <(basic_simple_string<C, T, A> const &lhs, #ifdef __STLSOFT_CF_TEMPLATE_OUTOFCLASSFN_QUALIFIED_TYPE_SUPPORT ss_typename_type_k basic_simple_string<C, T, A>::char_type const *rhs) #else C const *rhs) #endif /* __STLSOFT_CF_TEMPLATE_OUTOFCLASSFN_QUALIFIED_TYPE_SUPPORT */ { return lhs.compare(rhs) < 0; } Nevertheless, this is a compiler error, so though you'd want to knowfix) Matthew
Feb 08 2003
Here goes template <typename V> class cls { public: typedef V value_type; typedef cls<V> class_type; }; template <typename V> #if 1 inline bool operator ==(cls<V>::class_type const &lhs, cls<V>::value_type const &rhs) #else inline bool operator ==(cls<V> const &lhs, V const &rhs) #endif /* 0 */ { return false; } int main() { typedef cls<int> cls_t; cls_t c1; int i1; if(c1 == i1) {} return 0; } If you change the #if 1 to #if 0 it works fine. As is, it gives Internal error: template 3726 --- errorlevel 1 Matthew "Matthew Wilson" <dmd synesis.com.au> wrote in message news:b24fo3$1jkh$1 digitaldaemon.com...Will do "Walter" <walter digitalmars.com> wrote in message news:b24fkk$1jj8$1 digitaldaemon.com...Can you give me a complete test case? Thanks, -Walter "Matthew Wilson" <dmd synesis.com.au> wrote in message news:b21m9f$5pj$1 digitaldaemon.com...(andWalter Receive the following: Internal error: template 3726 --- errorlevel 1 when the operator <() for lhs = simple_string, rhs = char_type const * The actual function is defined as template< ss_typename_param_k C , ss_typename_param_k T , ss_typename_param_k A > inline ss_bool_t operator <(basic_simple_string<C, T, A> const &lhs, ss_typename_type_k basic_simple_string<C, T, A>::char_type const *rhs) { return lhs.compare(rhs) < 0; } I built in a workaround for this some months ago in a couple of other classes, and was a bit stupid in forgetting it. The workaround is: template< ss_typename_param_k C , ss_typename_param_k T , ss_typename_param_k A > inline ss_bool_t operator <(basic_simple_string<C, T, A> const &lhs, #ifdef __STLSOFT_CF_TEMPLATE_OUTOFCLASSFN_QUALIFIED_TYPE_SUPPORT ss_typename_type_k basic_simple_string<C, T, A>::char_type const *rhs) #else C const *rhs) #endif /* __STLSOFT_CF_TEMPLATE_OUTOFCLASSFN_QUALIFIED_TYPE_SUPPORT */ { return lhs.compare(rhs) < 0; } Nevertheless, this is a compiler error, so though you'd want to knowfix) Matthew
Feb 08 2003