[LLVMbugs] [Bug 18041] New: Inconsistent handling of C++ comments in C89 mode

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Nov 23 05:41:06 PST 2013


http://llvm.org/bugs/show_bug.cgi?id=18041

            Bug ID: 18041
           Summary: Inconsistent handling of C++ comments in C89 mode
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: mimomorin at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

I compiled three test codes with -std=c89 compiler option.

(A)
  int main(void)
  {
      //
      return 0;
  }

(B)
  int main(void)
  {
      //
      //*
      return 0;
  }

(C)
  int main(void)
  {
      //*
      return 0;
  }

Code (A) compiles fine with a warning
  a.c:3:5: warning: // comments are not allowed in this language [-Wcomment]

Code (B) behaves in the same way as (A).

Code (C) fails to compile with the following errors:
  c:3:5: error: expected expression
      //*
      ^
  c:3:6: error: unterminated /* comment
      //*
       ^

The behavior of Code (C) is inconsistent with those of Codes (A) and (B).
Tested on clang trunk.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20131123/c80b07bd/attachment.html>


More information about the llvm-bugs mailing list