[PATCH] D122029: Change __auto_type behavior with qualifiers to match GCC behavior

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 21 06:13:59 PDT 2022


aaron.ballman added inline comments.


================
Comment at: clang/lib/AST/ASTContext.cpp:10290
+    // information.
+    if (const auto *AT = LHS->getAs<AutoType>()) {
+      if (AT->getKeyword() == AutoTypeKeyword::GNUAutoType)
----------------
erichkeane wrote:
> So do we care if BOTH sides are this auto type?  Further question: can there be more than 1 of these 'GNUAutoType's in the type system such that 10211 wouldn't fire? 
> 
> Also, slight preference for AutoType having 'isGNUAutoTYpe' on it instead of this dance everywhere.
> 
> Speaking of which: that also makes me concerned about all the places in our code that assume `!isDeclTypeAuto` means C++ auto....  But that is perhaps for a future bug reporter to discover.
> So do we care if BOTH sides are this auto type? 

This only fires when the type classes don't match, see 10272.

> Further question: can there be more than 1 of these 'GNUAutoType's in the type system such that 10211 wouldn't fire?

Yes, but we wouldn't hit this block of code in that case because the type classes would match.

> Also, slight preference for AutoType having 'isGNUAutoTYpe' on it instead of this dance everywhere.

I was on the fence about that, and this gets me off the fence.

> Speaking of which: that also makes me concerned about all the places in our code that assume !isDeclTypeAuto means C++ auto.... But that is perhaps for a future bug reporter to discover.

+1


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

https://reviews.llvm.org/D122029



More information about the cfe-commits mailing list