Problem with bool data type in overloading

Please find the following error.

I did following typedef:

typedef bool Boolean;

typedef signed int Sint32;

Problem description:

This error is occurring because Sun CC 5.9 or Solaris 9 g++ considers bool data type as signed Integer, when passed as an constructor argument. First, it is overloading the constructor with bool data type and when it comes the turn of signed integer to overload constructor, the compiler is giving an error cannot be overloaded. The error redefinition is also due to bool data type.

Could please let me know, whether i need to add ant compiler option on Sun CC

ERROR in g++:-

( /usr/local/bin/g++ -DSOLARIS_PLATFORM -DUNIX -DPEGASUS_PLATFORM_SOLARIS_SPARC_GNU -DPEGASUS_OS_SOLARIS -DPEGASUS_HAVE_TEMPLATE_SPECIALIZATION -DEXPAND_TEMPLATES -DPEGASUS_USE_EXPERIMENTAL_INTERFACES -Wno-non-template-friend -DTEST_VAI -D__EXTERN_C__ -Dregister= -D_POSIX_PTHREAD_SEMANTICS -Wno-deprecated -DAUTOPASS_DISABLED -DCLUSTER_GEN_APP -DSTAND_ALONE_INTEG -I"/TESTBUILD/p2.08.00/TESTsrc" -I/TESTBUILD/pegasus/src -I"/TESTBUILD/p2.08.00/TESTCommonLib" -O -c -o /TESTBUILD/p2.08.00/TESTobj/TESTBase.o /TESTBUILD/p2.08.00/TESTsrc/TESTBase.cpp );

In file included from /TESTBUILD/pegasus/src/Pegasus/Common/Array.h:74,

from /TESTBUILD/pegasus/src/Pegasus/Common/CIMName.h:40,

from /TESTBUILD/pegasus/src/Pegasus/Client/CIMClient.h:39,

from /TESTBUILD/v2.08.00/TESTsrc/TESTVAIInterface.h:4,

from /TESTBUILD/v2.08.00/TESTsrc/TESTCaVAI.h:24,

from /TESTBUILD/v2.08.00/TESTsrc/TESTBase.h:11,

from /TESTBUILD/v2.08.00/TESTsrc/TESTBase.cpp:1:

/TESTBUILD/pegasus/src/Pegasus/Common/ArrayInter.h:49: error: redefinition of `class Pegasus::Array<Pegasus::Boolean>'

/TESTBUILD/pegasus/src/Pegasus/Common/ArrayInter.h:49: error: previous definition of `class Pegasus::Array<Pegasus::Boolean>'

In file included from /TESTBUILD/pegasus/src/Pegasus/Common/MessageLoader.h:42,

from /TESTBUILD/pegasus/src/Pegasus/Common/Exception.h:44,

from /TESTBUILD/pegasus/src/Pegasus/Common/CIMName.h:41,

from /TESTBUILD/pegasus/src/Pegasus/Client/CIMClient.h:39,

from /TESTBUILD/v2.08.00/TESTsrc/TESTVAIInterface.h:4,

from /TESTBUILD/v2.08.00/TESTsrc/TESTCaVAI.h:24,

from /TESTBUILD/v2.08.00/TESTsrc/TESTBase.h:11,

from /TESTBUILD/v2.08.00/TESTsrc/TESTBase.cpp:1:

/TESTBUILD/pegasus/src/Pegasus/Common/Formatter.h:114: error: `Pegasus::Formatter::Arg::Arg(Pegasus::Sint32)' and `Pegasus::Formatter::Arg::Arg(Pegasus::Boolean)' cannot be overloaded

In file included from /TESTBUILD/pegasus/src/Pegasus/Common/CIMProperty.h:40,

from /TESTBUILD/pegasus/src/Pegasus/Common/CIMObject.h:42,

from /TESTBUILD/pegasus/src/Pegasus/Client/CIMClient.h:41,

from /TESTBUILD/v2.08.00/TESTsrc/TESTVAIInterface.h:4,

from /TESTBUILD/v2.08.00/TESTsrc/TESTCaVAI.h:24,

from /TESTBUILD/v2.08.00/TESTsrc/TESTBase.h:11,

from /TESTBUILD/v2.08.00/TESTsrc/TESTBase.cpp:1:

/TESTBUILD/pegasus/src/Pegasus/Common/CIMValue.h:92: error: `Pegasus::CIMValue::CIMValue(Pegasus::Sint32)' and `Pegasus::CIMValue::CIMValue(Pegasus::Boolean)' cannot be overloaded

/TESTBUILD/pegasus/src/Pegasus/Common/CIMValue.h:147: error: `Pegasus::CIMValue::CIMValue(const Pegasus::Array<Pegasus::Boolean>&)' and `Pegasus::CIMValue::CIMValue(const Pegasus::Array<Pegasus::Boolean>&)' cannot be overloaded

/TESTBUILD/pegasus/src/Pegasus/Common/CIMValue.h:291: error: `void Pegasus::CIMValue::set(Pegasus::Sint32)' and `void Pegasus::CIMValue::set(Pegasus::Boolean)' cannot be overloaded

/TESTBUILD/pegasus/src/Pegasus/Common/CIMValue.h:323: error: `void Pegasus::CIMValue::set(const Pegasus::Array<Pegasus::Boolean>&)' and `void Pegasus::CIMValue::set(const Pegasus::Array<Pegasus::Boolean>&)' cannot be overloaded

/TESTBUILD/pegasus/src/Pegasus/Common/CIMValue.h:377: error: `void Pegasus::CIMValue::get(Pegasus::Sint32&) const' and `void Pegasus::CIMValue::get(Pegasus::Boolean&) const' cannot be overloaded

/TESTBUILD/pegasus/src/Pegasus/Common/CIMValue.h:409: error: `void Pegasus::CIMValue::get(Pegasus::Array<Pegasus::Boolean>&) const' and `void Pegasus::CIMValue::get(Pegasus::Array<Pegasus::Boolean>&) const' cannot be overloaded

*** Error code 1

make: Fatal error: Command failed for target `/TESTBUILD/v2.08.00/TESTsrc/TESTBase.or'

Same ERROR in Sun CC:-

--

palace /TESTBUILD/p2.08.00/TESTobj-> make -ef Make_SolarisVAICC TESTVAIrun

( /sun-share/SUNWspro/bin/CC-DSOLARIS_PLATFORM -DUNIX -DPEGASUS_PLATFORM_SOLARIS_SPARC_CC -features=bool -DPEGASUS_USE_EXPERIMENTAL_INTERFACES -DTEST_VAI -DEXPAND_TEMPLATES -D__EXTERN_C__ -DPEGASUS_INTERNALONLY -DPEGASUS_OS_SOLARIS -DPEGASUS_USE_EXPERIMENTAL_INTERFACES -DPEGASUS_USE_DEPRECATED_INTERFACES -Dregister= -D_POSIX_PTHREAD_SEMANTICS -DCLUSTER_GEN_APP -DSTAND_ALONE_INTEG -I"/TESTBUILD/v2.08.00/TESTsrc" -I"/Pegasus/pegasus-2.5/src" -I"/TESTBUILD/p2.08.00/TESTCommonLib" -O -c -o /TESTBUILD/p2.08.00/TESTobj/TESTBase.o /TESTBUILD/p2.08.00/TESTsrc/TESTBase.cpp );

"/Pegasus/pegasus-2.5/src/Pegasus/Common/ArrayInter.h", line 47: Error: Multiple declaration for Pegasus::Array<int>.

"/Pegasus/pegasus-2.5/src/Pegasus/Common/Formatter.h", line 103: Error: Multiple declaration for Pegasus::Formatter::Arg::Arg(int).

"/Pegasus/pegasus-2.5/src/Pegasus/Common/CIMValue.h", line 90: Error: Multiple declaration for Pegasus::CIMValue::CIMValue(int).

"/Pegasus/pegasus-2.5/src/Pegasus/Common/CIMValue.h", line 145: Error: Multiple declaration for Pegasus::CIMValue::CIMValue(const Pegasus::Array<int>&).

"/Pegasus/pegasus-2.5/src/Pegasus/Common/CIMValue.h", line 289: Error: Multiple declaration for Pegasus::CIMValue::set(int).

"/Pegasus/pegasus-2.5/src/Pegasus/Common/CIMValue.h", line 321: Error: Multiple declaration for Pegasus::CIMValue::set(const Pegasus::Array<int>&).

"/Pegasus/pegasus-2.5/src/Pegasus/Common/CIMValue.h", line 375: Error: Multiple declaration for Pegasus::CIMValue::get(int&) const.

"/Pegasus/pegasus-2.5/src/Pegasus/Common/CIMValue.h", line 407: Error: Multiple declaration for Pegasus::CIMValue::get(Pegasus::Array<int>&) const.

Thank and Regards,

Dileep

[6394 byte] By [dileepd.kumara] at [2007-11-27 11:56:44]
# 1

In Sun C++, type bool is not equivalent to signed int. I don't think g++ makes it equivalent either.

Please show an example of source code that is causing the problem.

clamage45a at 2007-7-29 19:09:15 > top of Java-index,Development Tools,Solaris and Linux Development Tools...