title: The body of constexpr function not a return-statement
body: <p>In the following program, I have added an explicit <code>return</code> statement in <code>func()</code>, but the compiler gives me the following error:</p>
  
  <pre><code>m.cpp: In function ‘constexpr int func(int)’:
  m.cpp:11:1: error: body of constexpr function ‘constexpr int func(int)’ not a return-statement
   }
  </code></pre>
  
  <p>This is the code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  constexpr int func (int x);
  
  constexpr int func (int x) 
  {
      if (x&lt;0)                
          x = -x;
      return x; // An explicit return statement 
  }
  
  int main() 
  {
      int ret = func(10);
      cout&lt;&lt;ret&lt;&lt;endl;
      return 0;
  }
  </code></pre>
  
  <p>I have compiled program in a <strong>g++</strong> compiler using the following command.</p>
  
  <pre><code>g++ -std=c++11 m.cpp
  </code></pre>
  
  <p>I have added <code>return</code> statement in function, then <strong>Why I got above error?</strong></p>