Initializing constexpr with const: Different treatment for int and double : <p>The following code fails to compile <a href="https://ideone.com/ubg5sQ" rel="noreferrer">live on Ideone</a>:</p>

<pre><code>#include &lt;iostream&gt;
using namespace std;

int main() {
    const double kPi = 3.14;
    constexpr double kPi2 = 2.0*kPi;
    cout &lt;&lt; kPi2;
}
</code></pre>

<p>The error message is:</p>

<blockquote>
<pre><code>prog.cpp: In function 'int main()':
prog.cpp:6:30: error: the value of 'kPi' is not usable in a constant expression
  constexpr double kPi2 = 2.0*kPi;
                              ^
prog.cpp:5:15: note: 'kPi' was not declared 'constexpr'
  const double kPi = 3.14;
</code></pre>
</blockquote>

<p>Substituting the <code>const</code> declaration for <code>kPi</code> with <code>constexpr</code>, <a href="https://ideone.com/B1fTB7" rel="noreferrer">it compiles successfully</a>.</p>

<p>On the other hand, when <code>int</code> is used instead of <code>double</code>, seems like <code>const</code> <a href="https://ideone.com/WiXnua" rel="noreferrer">plays well</a> with <code>constexpr</code>:</p>

<pre><code>#include &lt;iostream&gt;
using namespace std;

int main() {
    const int k1 = 10;
    constexpr int k2 = 2*k1;
    cout &lt;&lt; k2 &lt;&lt; '\n';
    return 0;
}
</code></pre>

<p>Why do <code>int</code> and <code>double</code> get different treatments for initializing a <code>constexpr</code> with <code>const</code>?<br>
Is this a bug in the Ideone compiler? Is this required by the C++ standard? Why is that?<br>
Was the above code UB?</p>

<p><strong>P.S.</strong> I tried with Visual Studio 2015 C++ compiler, and it compiles the first code snippet (initializing <code>constexpr</code> with <code>const</code>) just fine.</p>
