[PATCH] D113393: [c++2b] Implement P0849R8 auto(x)

Zhihao Yuan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 23 13:21:39 PST 2022


lichray marked an inline comment as done.
lichray added a comment.

In D113393#3340878 <https://reviews.llvm.org/D113393#3340878>, @aaron.ballman wrote:

> I spotted some test coverage that I think we should add:
>
>   static_cast<auto>(whatever);
>   reinterpret_cast<auto>(whatever);
>   const_cast<auto>(whatever);
>   dynamic_cast<auto>(whatever);
>   (auto)whatever;

Done.

> Are there changes needed for the AST printer for this new form of cast notation?

Wow, I broke AST print. CTAD works in expressions and new because their specializations are valid type-ids...

> I suppose one other question worth asking: if we're allowing `decltype(auto)(whatever)` as a Clang extension, should we be accepting `__typeof__(auto)(whatever)` as well?

We don't allow `__typeof__(auto)` type-specifier at the moment, so not yet. I think it may be more reasonable to allow both `__typeof__(auto)` and `typeof(auto)` when implementing C23 `typeof`. Their expression forms should be useful in C++.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113393/new/

https://reviews.llvm.org/D113393



More information about the cfe-commits mailing list