Conversion of false to object via const char * constructor
<p>I have built the following minimal example:</p>

<pre><code>class A
{
    public:
        A(const char *s);

    private:
        const char *p;
};

A::A(const char *s)
  : p(s)
{
}

A foo()
{
    return false;
}

A bar()
{
    return true;
}
</code></pre>

<p>Compiling with <code>g++ (Debian 4.7.2-5) 4.7.2</code> I get the following:</p>

<pre><code>t.cc: In function 'A foo()':
t.cc:17:10: warning: converting 'false' to pointer type for argument 1 of 'A::A(const char*)' [-Wconversion-null]
t.cc: In function 'A bar()':
t.cc:23:10: error: could not convert 'true' from 'bool' to 'A'
</code></pre>

<p>As far as I know, it is possible to use one type <code>T</code> instead of an instance of class <code>A</code>, if class <code>A</code> has a constructor <code>A(T)</code>. In this case, the value / instance of T is wrapped by the compiler inside a call to the <code>A(T)</code> constructor.</p>

<p>Also, only one direct implicit conversion is allowed, i.e. no chain <code>A(B(c))</code> is inserted to convert a value <code>c</code> of type <code>C</code>, even if constructors <code>A(B)</code> and <code>B(C)</code> exist.</p>

<p>So, my questions:</p>

<ol>
<li>Why is <code>false</code> converted to a pointer in my example? Sure, a pointer is not an object, but there are still two implicit conversions here. What rule is being applied?</li>
<li>Why does the conversion not work with <code>true</code>? My intuition is that <code>false</code> can be reasonably converted to a <code>nullptr</code> (see also the warning), whereas there is no meaningful pointer value for <code>true</code>.</li>
</ol>

<p>So, could someone explain what conversion rules apply / do not apply to the two examples above?</p>