<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><span class="vcard"><a class="email" href="mailto:jonathan.sauer@gmx.de" title="jonathan.sauer@gmx.de">jonathan.sauer@gmx.de</a>
</span> changed
<a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - Precompiler Error "##""
href="http://llvm.org/bugs/show_bug.cgi?id=17625">bug 17625</a>
<br>
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>What</th>
<th>Removed</th>
<th>Added</th>
</tr>
<tr>
<td style="text-align:right;">Status</td>
<td>NEW
</td>
<td>RESOLVED
</td>
</tr>
<tr>
<td style="text-align:right;">CC</td>
<td>
</td>
<td>jonathan.sauer@gmx.de
</td>
</tr>
<tr>
<td style="text-align:right;">Resolution</td>
<td>---
</td>
<td>INVALID
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - Precompiler Error "##""
href="http://llvm.org/bugs/show_bug.cgi?id=17625#c1">Comment # 1</a>
on <a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - Precompiler Error "##""
href="http://llvm.org/bugs/show_bug.cgi?id=17625">bug 17625</a>
from <span class="vcard"><a class="email" href="mailto:jonathan.sauer@gmx.de" title="jonathan.sauer@gmx.de">jonathan.sauer@gmx.de</a>
</span></b>
<pre>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:
<a href="http://stackoverflow.com/questions/1206624/differences-in-macro-concatenation-operator-between-visual-c-and-gcc">http://stackoverflow.com/questions/1206624/differences-in-macro-concatenation-operator-between-visual-c-and-gcc</a>
To get the code to work with clang, simply remove the "##", as string literals
next to each other will automatically be concatenated.</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>