[LLVMbugs] [Bug 12464] New: Macro expansion bug when a function-like macro is redefined in its own arguments.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Apr 5 09:10:26 PDT 2012


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

             Bug #: 12464
           Summary: Macro expansion bug when a function-like macro is
                    redefined in its own arguments.
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: paulgazzjunk at yahoo.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


clang does not handle this case from the GNU CPP manual: 
http://gcc.gnu.org/onlinedocs/cpp/Directives-Within-Macro-Arguments.html#Directives-Within-Macro-Arguments

#define f(x) x x
f (1
#undef f
#define f 2
f)

This expand to the following using gcc -E:

1 2 1 2

But instead clang sees this as an error and doesn't expand the macro:

function_arguments_directives.c:2:1: error: too many arguments provided to
      function-like macro invocation
f (1
^

f

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