www.digitalmars.com         C & C++   DMDScript  

c++.beta - boost 1_30_0 type_traits tests

reply Richard Grant <fractal clark.net> writes:
The samples below are extractions from 3 failed cases among some thousand or so
working test cases for the type_traits lib. Note that I am concerned with
compilation of the tests, and not execution of the tests.

ADD_CONST

This following is a sample code from one of the add_const tests. It compiles for
each of the builtin types, and enums, but chokes on user defined types.. I have
included add_const<int const> to show how builtin compiles fine.

struct A {
A(int i) { }
};

template <class T> struct add_const {
typedef T const type;
};

int main() {
add_const<int const>::type c = 0;
add_const<A const>::type a = 0;
//Error: illegal combination of types
}

ADD_VOLATILE

Similiar to const above, this one handles everything but the user defined type.

struct A {
A(int i) { }
};

template <class T> struct add_volatile {
typedef T volatile type;
};

int main() {
add_volatile<int volatile>::type c = 0;
add_volatile<A volatile>::type a = 0;
//Error: illegal combination of types
}

IS_BASE_AND_DERIVED

This is a somewhat new approach to perfoming templatized RTTI without the C++
RTTI mechanism.. It returns true if the derived class is derived from the base
class and false otherwise. Virtually all of the 200 or so tests from this
section work (including the "tricky" partial specialization compiler torture
tests), but when supplied with two references, some problems arise..

template <class T, class U> struct A;
template <class T, class U> struct A<T,U&> { };
template <class T, class U> struct A<T&,U> { };
template <class T, class U> struct A<T&,U&> { };

int main() {
A<int&,int&> a;
//Error: ambiguous match of class template partial specialization 'A'
}

Richard
Mar 27 2003
next sibling parent "Walter" <walter digitalmars.com> writes:
Thanks, I'll add them to the bug list!
Mar 27 2003
prev sibling next sibling parent reply Alisdair Meredith <alisdair.meredith uk.renaultf1.com> writes:
Richard Grant wrote:
 
 The samples below are extractions from 3 failed cases among some thousand or so
 working test cases for the type_traits lib. 

Nothing to do with typetraits, just a simple boost question <g> Do you have a dmc_tools.jam I can steal to build the boost libraries with bjam? Now I have got my head around the regression suite, I would quite like to add DMC to my testing. Unfortunately, I am not yet familiar enough with either DMC or xxx-tools.jam files to write my own yet. -- AlisdairM
Mar 27 2003
next sibling parent Richard Grant <fractal clark.net> writes:
Do you have a dmc_tools.jam I can steal to build the boost libraries
with bjam?

You'll have to go begging to Christof. I'm still working by hand. Richard
Mar 27 2003
prev sibling parent reply Christof Meerwald <cmeerw web.de> writes:
On Thu, 27 Mar 2003 22:57:15 +0000, Alisdair Meredith wrote:
 The samples below are extractions from 3 failed cases among some thousand or so
 working test cases for the type_traits lib. 

with bjam?

Have a look at http://cmeerw.org/prog/dm/boost.html - still not perfect, but mostly useable. bye, Christof -- http://cmeerw.org JID: cmeerw jabber.at mailto cmeerw at web.de ...and what have you contributed to the Net?
Mar 28 2003
parent reply John Fletcher <J.P.Fletcher aston.ac.uk> writes:
Christof Meerwald wrote:

 On Thu, 27 Mar 2003 22:57:15 +0000, Alisdair Meredith wrote:
 The samples below are extractions from 3 failed cases among some thousand or so
 working test cases for the type_traits lib.

with bjam?

Have a look at http://cmeerw.org/prog/dm/boost.html - still not perfect, but mostly useable. bye, Christof -- http://cmeerw.org JID: cmeerw jabber.at mailto cmeerw at web.de ...and what have you contributed to the Net?

Is this compatible with Boost 1_30_0, please? John
Apr 16 2003
parent Christof Meerwald <cmeerw web.de> writes:
On Wed, 16 Apr 2003 12:05:14 +0100, John Fletcher wrote:
 Christof Meerwald wrote:
 On Thu, 27 Mar 2003 22:57:15 +0000, Alisdair Meredith wrote:
 Do you have a dmc_tools.jam I can steal to build the boost libraries
 with bjam?

mostly useable.


the patch for Boost 1.29.0 doesn't cleanly apply to Boost 1.30.0 (but the Jam related things should be OK). BTW, I am currently working on updating my patch for Boost 1.30.0... (will hopefully have something useable in the next few days) bye, Christof -- http://cmeerw.org JID: cmeerw jabber.at mailto cmeerw at web.de ...and what have you contributed to the Net?
Apr 16 2003
prev sibling parent reply "Walter" <walter digitalmars.com> writes:
I fixed the first two, but the third has me concerned:

"Richard Grant" <fractal clark.net> wrote in message
news:b5vfln$23ut$1 digitaldaemon.com...
 This is a somewhat new approach to perfoming templatized RTTI without the

 RTTI mechanism.. It returns true if the derived class is derived from the

 class and false otherwise. Virtually all of the 200 or so tests from this
 section work (including the "tricky" partial specialization compiler

 tests), but when supplied with two references, some problems arise..

 template <class T, class U> struct A;
 template <class T, class U> struct A<T,U&> { };
 template <class T, class U> struct A<T&,U> { };
 template <class T, class U> struct A<T&,U&> { };

 int main() {
 A<int&,int&> a;
 //Error: ambiguous match of class template partial specialization 'A'
 }

I think this case *is* ambiguous. Class partial specialization matches do not go with the 'best' match like function overloading does, it goes with whichever is 'most specialized'. Most specialized is determined by if the arguments for one can be used as arguments to another, but not vice versa. In the case of references, each specialization here can be arguments to each other specialization. None is 'more specialized' than the other, hence it is ambiguous.
Mar 31 2003
parent "Walter" <walter digitalmars.com> writes:
Never mind :-(
Mar 31 2003