<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Wrong comment parsing with -std=c89"
   href="https://llvm.org/bugs/show_bug.cgi?id=23356">23356</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Wrong comment parsing with -std=c89
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>abramo.bagnara@bugseng.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=14257" name="attach_14257" title="Patch to fix C89 comment parsing">attachment 14257</a> <a href="attachment.cgi?id=14257&action=edit" title="Patch to fix C89 comment parsing">[details]</a></span>
Patch to fix C89 comment parsing

In general clang cannot parse line comments when they are not enabled,
otherwise valid code is seen as invalid. I've attached patch to fix that.

$ cat p.c
#define str_(x) #x
#define str(x) str_(x)
char *s = str(//);
$ clang-3.5 -std=c89 -c p.c
p.c:3:11: error: unterminated function-like macro invocation
char *s = str(//);
          ^
p.c:2:9: note: macro 'str' defined here
#define str(x) str_(x)
        ^
p.c:3:19: error: expected expression
char *s = str(//);
                  ^
p.c:3:10: error: expected ';' after top level declarator
char *s = str(//);
         ^
         ;
3 errors generated.
$ gcc -std=c89 -c p.c
$</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>