-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Open
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"diverges-from:edgDoes the clang frontend diverge from edg compiler on this issueDoes the clang frontend diverge from edg compiler on this issuediverges-from:gccDoes the clang frontend diverge from gcc on this issueDoes the clang frontend diverge from gcc on this issuediverges-from:msvcDoes the clang frontend diverge from msvc on this issueDoes the clang frontend diverge from msvc on this issue
Description
-- EDIT -- Added comment with a different example and a different problem, and another comment with a suggested fix.
When a macro definition has either 'a ## ## c', the result differs from GCC. I'm not sure what the standard requires, though I suspect the answer is same as 'a ## c'. It may depend on the order of evaluation of the ## operators.
Sample input
#define FOO(a, b, c) a ## b ## c, a ## ## c
FOO (x, , y)
FOO (x, 42, y)
Output from gcc -E is
xy, xy
x42y, xy
Output from clang -E is
xy, x ##y
x42y, x ##y
clang also emits an error about pasting 'x##'. It's apparently trying to paste the 'x' to the second '##'. Whereas GCC treats the '## ##' as being separated by a blank value and following the placeholder rules.
Metadata
Metadata
Assignees
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"diverges-from:edgDoes the clang frontend diverge from edg compiler on this issueDoes the clang frontend diverge from edg compiler on this issuediverges-from:gccDoes the clang frontend diverge from gcc on this issueDoes the clang frontend diverge from gcc on this issuediverges-from:msvcDoes the clang frontend diverge from msvc on this issueDoes the clang frontend diverge from msvc on this issue