title: How to use [[noreturn]] attribute in c++?
body: <p>According to <a href="https://stackoverflow.com/questions/10538291/what-is-the-point-of-noreturn">stack overflow</a>, The <code>[[noreturn]]</code> attribute specifies that a function does not return. Ok, thats fine.</p>
  
  <p>But I don't understand how to use <code>[[noreturn]]</code> attribute in program. I tried to use <code>[[noreturn]]</code> attribute in my code. But when I compiled my code in GCC compiler, I got following error.</p>
  
  <pre><code>error: expected unqualified-id before ‘[’ token
   [[noreturn]] void f(int i) {
   ^
  cp1.cpp: In function ‘int main()’:
  cp1.cpp:11:6: error: ‘f’ was not declared in this scope
    f(10);
  </code></pre>
  
  <p>My code is here:</p>
  
  <pre><code>#include &lt;cstdlib&gt;
  
  [[noreturn]] void f(int i) {
    if (i &gt; 0)
      throw "Received positive input";
    std::exit(0);
  }
  
  int main()
  {
          f(10);
  }
  </code></pre>
  
  <p>How to use <code>[[noreturn]]</code> attribute in C++?</p>