[PATCH] D98095: [clang] Fix ICE on invalid type parameters for concepts

Matheus Izvekov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 8 13:56:04 PST 2021


mizvekov added inline comments.


================
Comment at: clang/lib/Sema/SemaType.cpp:5947-5948
       TL.setNameLoc(DS.getTypeSpecTypeLoc());
       if (!DS.isConstrainedAuto())
         return;
       if (DS.getTypeSpecScope().isNotEmpty())
----------------
rsmith wrote:
> Given that we recover from an invalid `TemplateId` by creating an unconstrained `AutoType`, it would be more consistent to skip filling in the `NestedNameSpecifierLoc` here in that case too. (That way, we would populate the `NestedNameSpecifierLoc` if and only if we created a constrained `AutoType`.) I think it doesn't matter right now because no-one should look at this information for an unconstrained `AutoType`, but I could imagine we would switch to storing smaller `TypeLoc` data in the future if the type is unconstrained, and if we did, the writes to the `NestedNameSpecifierLoc` below would break.
Good catch, thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98095



More information about the cfe-commits mailing list