================ @@ -1518,7 +1526,7 @@ NamedDecl *Sema::ActOnNonTypeTemplateParameter(Scope *S, Declarator &D, QualType T = CheckNonTypeTemplateParameterType(TInfo, D.getIdentifierLoc()); if (T.isNull()) { - T = Context.IntTy; // Recover with an 'int' type. + T = TInfo->getType(); ---------------- offsetof wrote:
> In what sort of context does this matter? Does the effect of this show up in > any test? In the newly added section of `test/CXX/temp/temp.decls/temp.mem/p1.cpp`, without this change we'd fail to match the various `bad` definitions to their in-class declarations, creating extraneous diagnostics. More importantly, recovering with `int` in `RebuildTemplateParamsInCurrentInstantiation` would lead to the first invalid definition of `good` being accepted without a diagnostic. > Is it possible we might recover with something strange which will have weird > effects or crash later, like undeduced auto? The type ultimately comes from `GetTypeForDeclarator`, after substitution of `auto` for dependent `auto`, so it can certainly be "strange" as in semantically invalid in this context (incomplete, non-structural, etc.), but I think that's fine since we mark the decl as invalid (?) Note that currently `RebuildTemplateParamsInCurrentInstantiation` does not perform this check, so it's already possible to end up with such types on `NonTypeTemplateParmDecl`s that way. https://github.com/llvm/llvm-project/pull/132189 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits