[all-commits] [llvm/llvm-project] 87f09d: [clang] Parse `__typeof_unqual__` consistently wit...

Conscat via All-commits all-commits at lists.llvm.org
Mon Jun 1 07:51:57 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 87f09d325da79b379723b29755861da9baf2dc7a
      https://github.com/llvm/llvm-project/commit/87f09d325da79b379723b29755861da9baf2dc7a
  Author: Conscat <omg.lily2000 at gmail.com>
  Date:   2026-06-01 (Mon, 01 Jun 2026)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/lib/Parse/ParseExpr.cpp
    M clang/lib/Parse/ParseExprCXX.cpp
    M clang/lib/Parse/ParseTentative.cpp
    M clang/test/SemaCXX/typeof.cpp

  Log Message:
  -----------
  [clang] Parse `__typeof_unqual__` consistently with `__typeof__` (#198948)

C23 `__typeof_unqual` and `__typeof_unqual__` are supported in all
language modes as an extension.
However, existing tests missed this form:
```cpp
int main() {
   __typeof_unqual(int) x = 0;
}
```
That doesn't compile today.
```
<source>:2:4: error: expected expression
    2 |    __typeof_unqual(int) x = 0;
      |    ^
1 error generated.
Compiler returned: 1
```
I think the fix is to parse `tok::kw_typeof_unqual` everywhere that we
currently parse `tok::kw_typeof`. It simply falls through `case`s
beneath `tok::kw_typeof`, so this should handle them equivalently. No
keyword semantics are changed by this PR.

While in here I noticed Clang Format ignores the token too, so I gave
Clang Format the same parsing parity between these tokens. It now holds
true under `isTypeName()`, just like `typeof`. `__typeof_unqual` kind of
accidentally formatted correctly in C++ anyways, but not in C, so this
is a meaningful fix. Previously it had no tests at all.

In the `clang-format` release notes, I'm not sure whether this should be
considered a fix or a new feature. I've left the clang-format notes
unchanged for now.

Assisted-by: Cursor/Claude Opus



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list