title: How can I enforce an error when a function doesn't have any return in GCC?
body: <p>Is it possible to enforce an error (to break the build) when a function definition has no return in its body?</p>
  <p>Consider this function:</p>
  <pre><code>int sum(int a, int b) {
    int c = a + b;
    // And here should be return
  };
  </code></pre>
  <p>When I compile with <code>g++ -Wall</code>, I get:</p>
  <blockquote>
  <p>no <code>return</code> statement in function returning non-void [<code>-Wreturn-type</code>]</p>
  </blockquote>
  <p>But I want this to be a hard error rather than a warning.</p>
  <p>I'm currently using GCC 4.9.2, but if there's a solution for different version of GCC that would be helpful to know, too.</p>