https://bugs.llvm.org/show_bug.cgi?id=50600

            Bug ID: 50600
           Summary: clang detects dollars in macro arguments instead of
                    identifiers.
           Product: clang
           Version: 12.0
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected]

clang detects a dollar in identifier, when there is no such
identifier, but only a string, as per the macro.  It should do that after
macro-expansion, not before.

Makefile:
```
all:
        clang -Wdollar-in-identifier-extension -o pgm gcc-dollar-bug.c
        ./pgm
```

gcc-dollar-bug.c:
```
#include <stdio.h>

#define S(x) #x

int main(void){
    printf("Good string: %s\n",S($HELLO));
    return 0;}
```

```
[pjb@despina org.xquartz:0 gcc-dollar-bug 23Gi]$ make
clang -Wdollar-in-identifier-extension -o pgm gcc-dollar-bug.c
gcc-dollar-bug.c:6:34: warning: '$' in identifier
[-Wdollar-in-identifier-extension]
    printf("Good string: %s\n",S($HELLO));
                                 ^
1 warning generated.
./pgm
Good string: $HELLO
[pjb@despina org.xquartz:0 gcc-dollar-bug 23Gi]$

#+END_EXAMPLE
```

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to