================ @@ -6930,17 +6934,20 @@ ExprResult Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param, IsConvertedConstantExpression = false; } - if (getLangOpts().CPlusPlus17) { + if (getLangOpts().CPlusPlus17 || PartialOrderingTTP) { // C++17 [temp.arg.nontype]p1: // A template-argument for a non-type template parameter shall be // a converted constant expression of the type of the template-parameter. APValue Value; ExprResult ArgResult; if (IsConvertedConstantExpression) { - ArgResult = BuildConvertedConstantExpression(Arg, ParamType, - CCEK_TemplateArg, Param); - if (ArgResult.isInvalid()) + ArgResult = BuildConvertedConstantExpression( + Arg, ParamType, + PartialOrderingTTP ? CCEK_InjectedTTP : CCEK_TemplateArg, Param); + if (ArgResult.isInvalid()) { ---------------- erichkeane wrote:
ExprResult always being initialized isn't a bad idea... but a much bigger change than i'd request here. That said, the `Build/Act` functions SOMETIMES return uninit (even if by accident sometimes, particularly when used as an out param). So the `isUsable` is both what we typically mean, and the safer option. I realize we are bad about `isInvalid` all over the place, I've actively been trying to stop using it as we never MEAN it, so I show a strict preference for `isUsable`, particularly in these cases. IMO, `isInvalid` becoming deprecated is perhaps of value. https://github.com/llvm/llvm-project/pull/124313 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits