Initialize instance with integer constant 0 but no other constant value or integer variable
<p>I want to define a class whose instances can be constructed, implicitly constructed, or assigned from an integer constant zero, but not from any other numeric constant, and not from a variable with integer type (even if its value happens to be zero at runtime).  It should also be copy-constructible from other instances of the same class.  Use of C++11 features is okay as long as they're supported (in the appropriate mode) by both g++ 4.6 and MSVC 2010.</p>

<p>Concretely, given</p>

<pre><code>class X { /* ... */ };
void fn(X);
</code></pre>

<p>these should all compile:</p>

<pre><code>X a(0);
X b = 0;
X c; c = 0;
X d = a;
X e; e = a;
fn(0);
</code></pre>

<p>but these should not:</p>

<pre><code>X f(1);
X g = 1;
X h; h = 1;
fn(1);

int ii = 23;
X a(ii);
X j = ii;
X k; k = ii;
fn(ii);
</code></pre>

<p>I tried this, but it didn't work:</p>

<pre><code>class X {
public:
   X() {} 
   constexpr X(int v) { static_assert(v == 0, "must be initialized from zero"); }
};
</code></pre>

<p>&longrightarrow;</p>

<pre><code>test.cc: In constructor ‘constexpr X::X(int)’:
test.cc:3:29: error: non-constant condition for static assertion
test.cc:3:29: error: ‘v’ is not a constant expression
</code></pre>
