From: daniel.kruegler@googlemail.com   
      
   Am 03.06.2011 23:26, schrieb Piotr Wyderski:   
   >   
   > Hello,   
   >   
   > what should std::is_convertible::value   
   > return in the following cases:   
   >   
   > class XXX {   
   >   
   > public:   
   >   
   > XXX(int) {}   
   > XXX(unsigned) {}   
   > };   
      
   The result should be false, because there is no single best conversion   
   sequence in this example.   
      
   > and:   
   >   
   > class XXX {   
   >   
   > public:   
   >   
   > XXX(char) {}   
   > template XXX(T) = delete;   
   > };   
      
   The result should also be false, but this time, because the constructor   
   template is a better match compared to the non-template constructor. The   
   selected constructor is a deleted function, therefore the conversion is   
   ill-formed, thus leading to a negative result of is_convertible.   
      
   > GCC 4.6 refuses to compile both of them.   
      
   This must be a defect implementation then. There is no reason why either   
   of these examples should not lead in well-formed code when   
   std::is_convertible is instantiated.   
      
   > The second case   
   > is most interesting, because this behaviour somehow contradicts   
   > the intentions of the N2346 proposal:   
   >   
   > http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2346.htm   
   >   
   > "Removing dangerous conversions is as important as removing undesired   
   > language defaults.   
   >   
   > struct type   
   > {   
   > type( long long ); // can initialize with an long long   
   > type( long ) = delete; // but not anything less   
   > };   
   > extern void bar( type, long long ); // and the same for bad overloads   
   > void bar( type, long ) = delete; // of free functions   
   > "   
      
   I don't see the contradiction. These examples should realize what they   
   are intended to realize.   
      
   Btw.: GCC 4.7 does accept both code examples and behaves as expected.   
      
   HTH & Greetings from Bremen,   
      
   - Daniel Krügler   
      
      
   --   
    [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
    [ comp.lang.c++.moderated. First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|