mirror of
https://github.com/boostorg/utility.git
synced 2025-05-09 15:04:00 +00:00
Fixed Intel 7 issue (reported by Daniel Frey)
[SVN r19145]
This commit is contained in:
parent
3bd833c8ff
commit
d1d0d6b788
@ -23,9 +23,8 @@ namespace
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
Incomplete * p;
|
Incomplete * p = 0;
|
||||||
boost::checked_delete(p); // should cause compile time error
|
boost::checked_delete(p); // should cause compile time error
|
||||||
Incomplete ** pa;
|
boost::checked_array_delete(p); // should cause compile time error
|
||||||
boost::checked_array_delete(pa); // should cause compile time error
|
|
||||||
return 0;
|
return 0;
|
||||||
} // main
|
} // main
|
||||||
|
@ -26,13 +26,14 @@ namespace boost
|
|||||||
|
|
||||||
template<class T> inline void checked_delete(T * x)
|
template<class T> inline void checked_delete(T * x)
|
||||||
{
|
{
|
||||||
typedef char type_must_be_complete[sizeof(T)];
|
// Intel 7 accepts sizeof(incomplete) as 0 in system headers
|
||||||
|
typedef char type_must_be_complete[ sizeof(T)? 1: -1 ];
|
||||||
delete x;
|
delete x;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T> inline void checked_array_delete(T * x)
|
template<class T> inline void checked_array_delete(T * x)
|
||||||
{
|
{
|
||||||
typedef char type_must_be_complete[sizeof(T)];
|
typedef char type_must_be_complete[ sizeof(T)? 1: -1 ];
|
||||||
delete [] x;
|
delete [] x;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,6 +44,7 @@ template<class T> struct checked_deleter
|
|||||||
|
|
||||||
void operator()(T * x) const
|
void operator()(T * x) const
|
||||||
{
|
{
|
||||||
|
// boost:: disables ADL
|
||||||
boost::checked_delete(x);
|
boost::checked_delete(x);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user