Issue 174966
Summary Poor Clang diagnostic for string literal concatenation with undefined macro
Labels clang:diagnostics
Assignees
Reporter zmodem
    Example:

```
#define BAR "bar"
const char *s = "foo" BAAR;
```

The author intended to concatenate "foo" with the string defined by the `BAR` macro but misspelled it. The diagnostic doesn't even mentioned the misspelled (and therefore undefined) macro though:

```
$ build/bin/clang -c /tmp/a.c
/tmp/a.c:2:22: error: expected ';' after top level declarator
 2 | const char *s = "foo" BAAR;
      |                      ^
      | ;
1 error generated.
```

Other compilers have similar output (https://godbolt.org/z/o1GqPYdrG), but maybe Clang could do better?
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to