title: g++ regex crash on (possibly unsyntactic) expression
body: <p>I figure the following program should either complain it can't compile the regular expression or else treat it as legal and compile it fine (I don't have the standard so I can't say for sure whether the expression is strictly legal; certainly reasonable interpretations are possible). Anyway, what happens with <code>g++ (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1</code> is that, when run, it crashes hard </p>
  
  <pre><code>*** Error in `./a.out': free(): invalid next size (fast): 0x08b51248 ***
  </code></pre>
  
  <p>in the guts of the library.</p>
  
  <p>Questions are:</p>
  
  <p>a) it's bug, right? I assume (perhaps incorrectly) the standard doesn't say std::regex can crash if it doesn't like the syntax. (msvc eats it fine, fwiw)</p>
  
  <p>b) if it's a bug, is there some easy way to see whether it's been reported or not (my first time poking around gnu-land bug systems was intimidating)?</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;regex&gt;
  
  int main(void)
      {
      const char* Pattern = "^(%%)|";
      std::regex Machine;
  
      try {
          Machine = Pattern;
          }
      catch(std::regex_error e)
          {
          std::cerr &lt;&lt; "regex could not compile pattern: "
            &lt;&lt; Pattern &lt;&lt; "\n"
            &lt;&lt; e.what() &lt;&lt; std::endl;
          throw;
          }
  
      return 0;
      }
  </code></pre>