Boost logo

Boost :

Subject: Re: [boost] [type_traits] common_type fails when typeof is not used
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2011-01-13 00:39:05

----- Original Message -----
From: "John Maddock" <boost.regex_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Wednesday, January 12, 2011 2:32 PM
Subject: Re: [boost] [type_traits] common_type fails when typeof is not used

> Fixed header applied to Trunk as of rev 68040.
> I modified your tests somewhat and added updated test cases as well (with
> one case to test when BOOST_COMMON_TYPE_DONT_USE_TYPEOF is defined).
> Thanks! John.

Thanks John.

There is yet an error on Sun compiler that is not really related to common_type code, but to the test code itself.

Test output: Sandia-sun - type_traits - common_type_test / sun-5.10
Rev 68075 / Thu, 13 Jan 2011 01:15:43 +0000
Report Time: Thu, 13 Jan 2011 04:05:07 +0000
Compile [2011-01-13 02:07:06 UTC]: fail
    "/opt/sunstudio12.1/bin/CC" +d -library=stlport4 -features=tmplife -features=tmplrefstatic -g -erroff=%none -errwarn -m64 -KPIC -DBOOST_ALL_NO_LIB=1 -I".." -c -o "/scratch2/kbelco/boost/results/boost/bin.v2/libs/type_traits/test/common_type_test.test/sun-5.10/debug/address-model-64/stdlib-sun-stlport/common_type_test.o" "../libs/type_traits/test/common_type_test.cpp"

"../libs/type_traits/test/common_type_test.cpp", line 47: Error: ac must be initialized.
"../libs/type_traits/test/common_type_test.cpp", line 88: Where: While instantiating "assignation_2<C1C2, C1>()".
"../libs/type_traits/test/common_type_test.cpp", line 88: Where: Instantiated from non-template code.

On the web I have found that

Warning: Objects of type AAAA must be initialized
This warning is produced when you use new() to allocate a const object without providing an initial value or a default constructor, as shown in the following example:

  const int * ip = new const int;

This is an error, since constants of unknown value are not useful. The solution is to add an initializer. The preceding example would then become

  const int * ip = new const int(0);

I guess that we can change the test code so the default constructor is explicit to avoid this Sun error

struct C1 {
  C1() {};
struct C2 {
  C1() {};};



Boost list run by bdawes at, gregod at, cpdaniel at, john at