[LLVMbugs] [Bug 10698] New: #define followed by a comment while clang is started with -C

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Aug 18 06:07:19 PDT 2011


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

           Summary: #define followed by a comment while clang is started
                    with -C
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: eremeev at viva64.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


If starting Clang preprocessor with -E -C command line options on the code:

        #if defined A    // some comment
    ...
        #endif

generates the following error message:

definecomment.cpp:1:16: error: token is not a valid binary operator in a
preprocessor subexpression
        #if defined A   // some comment
            ~~~~~~~~~   ^
<scratch space>:2:1: note: expanded from:
/* some comment*/
^
#line 1 "definecomment.cpp"
#line 1 "definecomment.cpp"
#line 1 "<built-in>"
#line 1 "<built-in>"
#line 144 "<built-in>"
#line 1 "<command line>"
#line 1 "<built-in>"
#line 1 "definecomment.cpp"

1 error generated.
This code creates no issues with MSVC compiler. Starting Clang with only -E
switch works fine as well.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list