Hi,

a friend of mine reported the same problem some days ago.

It looks like the clang compiler (or the standard library to be more precise) tries to convert a integer literal to a char_type. The char_type is cxxtools::Char, which represents a unicode character.

Some time ago I reworked the cxxtools::Char since I felt, the conversions are to lax. I feel, that it should not be allowed to write something like:

   cxxtools::Char ch;
   ch = 17;

It is much better to make it explicit:

   cxxtools::Char ch;
   ch = cxxtools::Char(17);

Hence I made the constructor cxxtools::Char::Char(int32_t) explicit (among other changes).

But here OSX fails, since it tries to do exactly that:

/usr/bin/../lib/c++/v1/locale:1402:15: error:
      conversion from 'int' to 'char_type' (aka 'cxxtools::Char') is ambiguous
    char_type __thousands_sep = 0;

It should be:

/usr/bin/../lib/c++/v1/locale:1402:15: error:
      conversion from 'int' to 'char_type' (aka 'cxxtools::Char') is ambiguous
    char_type __thousands_sep =*char_type(*0*)*;

I don't really know, what is the best way to solve it. I like the strictness of cxxtools::Char. I feel, that it is a bug in the standard library of OSX.

The possible solutions I see are:

 * remove explicit from cxxtools::Char::Char(int)
 * do nothing but report the OS X people (or clang people) the bug
 * make a configure check and make explicit where possible

Any opinions?

Tommi


Am 03.11.2013 09:09, schrieb Dmitry Dneprov:
I have upgraded my mac to OS X 10.9 and Xcode to latest version.
After upgrade cxxtools does not compile.

Darwin Kernel Version 13.0.0
x86_64

gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr
--with-gxx-include-
dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform
/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix



/bin/sh ../libtool --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I../src
-I../include -I../include -Wno-long-long -Wall -pedantic  -g -O2
-MT base64codec.lo -MD -MP -MF
.deps/base64codec.Tpo -c -o base64codec.lo base64codec.cpp
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I../src -I../include -I../include
-Wno-long-long -Wall -pedantic -g -O2 -MT base64codec.lo -MD -MP -MF
.deps/base64codec.Tpo -c
base64codec.cpp  -fno-common -DPIC -o .libs/base64codec.o
In file included from base64codec.cpp:29:
In file included from ../include/cxxtools/base64codec.h:32:
In file included from ../include/cxxtools/textcodec.h:32:
In file included from ../include/cxxtools/char.h:414:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
/usr/bin/../lib/c++/v1/locale:1402:15: error:
       conversion from 'int' to 'char_type' (aka 'cxxtools::Char') is ambiguous
     char_type __thousands_sep = 0;
               ^                 ~
../include/cxxtools/facets.h:93:61: note: in instantiation of member function
'std::__1::num_get<cxxtools::Char,
       std::__1::istreambuf_iterator<cxxtools::Char, std::__1::
       char_traits<cxxtools::Char> > >::do_get' requested here
         std::locale::global( std::locale(std::locale(),
         new std::num_get<cxxtools::Char>) );
             ^
../include/cxxtools/char.h:76:13: note: candidate constructor
             Char(char ch)
             ^
../include/cxxtools/char.h:81:13: note: candidate constructor
             Char(unsigned char ch)
             ^
../include/cxxtools/char.h:86:13: note: candidate constructor
             Char(wchar_t ch)
             ^
1 error generated.
make[2]: *** [base64codec.lo] Error 1
make[1]: *** [all] Error 2
make: *** [all-recursive] Error 1


------------------------------------------------------------------------------
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general

------------------------------------------------------------------------------
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general

Reply via email to