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

[email protected] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |[email protected]
         Resolution|---                         |INVALID

--- Comment #1 from [email protected] ---
I get with clang r192574 on Mac OS X:

% ~/LLVM/build/Release+Asserts/bin/clang -c clang.c clang.c:9:3: error: pasting
formed '"Hello""World"', an invalid preprocessing token
  TESTDEFINE2("Hello", "World");
  ^
clang.c:4:41: note: expanded from macro 'TESTDEFINE2'
#define TESTDEFINE2(a,b) printf("%s", a ## b) 
                                        ^
1 error generated.


I think that clang's behavior is correct, as per C11 §6.10.3.3p3 the result of
the token pasting operator ## must be a valid preprocessing token or the
behavior is undefined; and while a single string literal is a valid
preprocessing token (as defined in §6.4p3), two string literals are not (they
would be if they were *two separate* tokens, but ## produces a *single* token).

If you are coming from Visual C, this might help you:
http://stackoverflow.com/questions/1206624/differences-in-macro-concatenation-operator-between-visual-c-and-gcc

To get the code to work with clang, simply remove the "##", as string literals
next to each other will  automatically be concatenated.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to