Add a fix for a crash in MSVC 2008.

MSVC 2008 doesn't seem to like

typedef typename foo<bar>::rhs_type rhs_type;

It ends with an internal compiler error, so changed the typedef to use
different names for rhs_type.
This commit is contained in:
Mark de Wever 2008-12-04 19:54:48 +00:00
parent 2f700cd925
commit 47ab2f2d8d
2 changed files with 21 additions and 6 deletions

View file

@ -168,7 +168,15 @@ template <
struct tcopy_policy : public base, public copy_policy<tcopy_policy<base, copy_policy> >
{
typedef copy_policy<tcopy_policy<base, copy_policy> > policy;
typedef typename tcopy_policy<base, copy_policy>::rhs_type rhs_type;
/*
* This typedef first was
* typedef typename tcopy_policy<base, copy_policy>::rhs_type rhs_type;
*
* Unfortunately MSVC 2008 chokes on it and aborts with an internal
* compiler error. So used another name for the type.
*/
typedef typename tcopy_policy<base, copy_policy>::rhs_type
tcopy_policy_rhs_type;
tcopy_policy()
: base()
@ -179,7 +187,7 @@ struct tcopy_policy : public base, public copy_policy<tcopy_policy<base, copy_po
#endif
}
tcopy_policy(rhs_type rhs)
tcopy_policy(tcopy_policy_rhs_type rhs)
: base(rhs)
, policy(rhs)
{
@ -189,7 +197,7 @@ struct tcopy_policy : public base, public copy_policy<tcopy_policy<base, copy_po
copy(rhs);
}
tcopy_policy& operator=(rhs_type rhs)
tcopy_policy& operator=(tcopy_policy_rhs_type rhs)
{
#if COPY_POLICY_DEBUG
std::cerr << "tcopy_policy: assignment operator.\n";

View file

@ -34,7 +34,14 @@ template <template<class> class copy_policy >
struct ttest : public copy_policy<ttest<copy_policy> >
{
typedef copy_policy<ttest<copy_policy> > policy;
typedef typename ttest<copy_policy>::rhs_type rhs_type;
/*
* This typedef first was
* typedef typename ttest<copy_policy>::rhs_type rhs_type;
*
* Unfortunately MSVC 2008 chokes on it and aborts with an internal
* compiler error. So used another name for the type.
*/
typedef typename ttest<copy_policy>::rhs_type ttest_rhs_type;
ttest()
: policy()
@ -48,7 +55,7 @@ struct ttest : public copy_policy<ttest<copy_policy> >
#endif
}
ttest(rhs_type rhs)
ttest(ttest_rhs_type rhs)
: policy(rhs)
, copied_constructed_(true)
, assigned_(rhs.assigned_)
@ -61,7 +68,7 @@ struct ttest : public copy_policy<ttest<copy_policy> >
copy(rhs);
}
ttest& operator=(rhs_type rhs)
ttest& operator=(ttest_rhs_type rhs)
{
#if TEST_POLICY_DEBUG
std::cerr << __func__ << ".\n";