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

            Bug ID: 19141
           Summary: ##__VA_ARGS__ does not expand inner macros, whereas
                    __VA_ARGS__ works as expected
           Product: clang
           Version: 3.4
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

##__VA_ARGS__ does not expand inner macros, whereas __VA_ARGS__ works as
expected.

This input file (foo.m):

[--
#define F1(...) [NSString stringWithFormat:__VA_ARGS__]
#define F2(format, ...) [NSString stringWithFormat:(format), ##__VA_ARGS__]

    NSLog(F1(@"%@", F1(@"%@", @"a")));
    NSLog(F2(@"%@", F2(@"%@", @"a")));
--]

when processed with `clang -E -o foo.i foo.m`, produces the following output:

[--
# 1 "foo.m"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 178 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "foo.m" 2



    NSLog([NSString stringWithFormat:@"%@", [NSString stringWithFormat:@"%@",
@"a"]]);
    NSLog([NSString stringWithFormat:(@"%@"), F2(@"%@", @"a")]);
--]

Version Details:

[--
$ clang --version
Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.1.0
Thread model: posix
--]

-- 
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