Issue 151102
Summary Clang format produces code which does not compile with clang
Labels clang
Assignees
Reporter SamCoutteauHybrid
    When using the clang-format options:
```
IntegerLiteralSeparator:
 BinaryMinDigits: 16
  Binary: 8
  Decimal: 3
  DecimalMinDigits: 6
  Hex: 2
  HexMinDigits: 8
```

To insert decimal separators it can produce the following code.

```
#if __cpp_lib_source_location < 201'907L
```

where a decimal separator is added in the preprocessor constant.

It seems clang cannot compile this unless at least c++14 is used.

https://godbolt.org/z/f1zYWd778

However even when setting:

```
Standard: c++11 
```

clang format still adds the decimal separator.

Further more

```
#if __cpp_lib_source_location < 201'907L
#endif
```

works using:

* `clang -std=c++14 -E test.hpp`

does not work using

* ` clang -std=c++11 -E test.hpp`
* `clang-scan-deps -format=p1689 -- clang -std=c++14 test.hpp`

So it seems clang-format is producing wrong results and clang-scan-deps is ignoring `-std=c++14`
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to