[clang] Fix printing of templated records. (PR #86339)

Kazu Hirata via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 26 12:52:55 PDT 2024


kazutakahirata wrote:

> Creating a PR with `[](PrintingPolicy [[maybe_unused]] & Policy) { Policy.SuppressTagKeyword = true; };` on those tests.

I get this error while running `ninja check-clang-unit`.  My build tree is configured with `-DCMAKE_CXX_COMPILER=/usr/bin/clang++` and `-DLLVM_ENABLE_WERROR=On`.

By the way:

```
[](PrintingPolicy [[maybe_unused]] &Policy) { Policy.SuppressTagKeyword = false; };
```

would result in:

```
clang/unittests/AST/DeclPrinterTest.cpp:1394:23: error: 'maybe_unused' attribute cannot be applied to types
```

```
[[maybe_unused]] [](PrintingPolicy &Policy) { Policy.SuppressTagKeyword = false; };
```

would result in:

```
clang/unittests/AST/DeclPrinterTest.cpp:1394:5: error: 'maybe_unused' attribute cannot be applied to a statement
```

I don't know where to put `[[maybe_unused]]`.


https://github.com/llvm/llvm-project/pull/86339


More information about the cfe-commits mailing list