[clang] [Clang] Allow explicit member specialization to differ from template declaration wrt constexpr (PR #145272)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 25 09:02:35 PDT 2025
================
@@ -12163,6 +12163,23 @@ bool Sema::CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD,
}
}
+ // C++11 [dcl.constexpr]p1: An explicit specialization of a constexpr
+ // function can differ from the template declaration with respect to
+ // the constexpr specifier.
+ if (IsMemberSpecialization) {
+ FunctionDecl *InstantiationFunction =
+ OldDecl ? OldDecl->getAsFunction() : nullptr;
+ if (InstantiationFunction &&
+ InstantiationFunction->getTemplateSpecializationKind() ==
+ TSK_ImplicitInstantiation &&
----------------
erichkeane wrote:
That is what I'm wondering, I think from reading the standard that the ONLY thing that matters is that the current one is an explicit specialization. The kind of the 'old' thing we found is irrelevant. It should always end up being a primary template (but even if it isn't, it shouldn't matter?). And even the existence of it doesn't matter, so long as we know we are an explicit specialization.
https://github.com/llvm/llvm-project/pull/145272
More information about the cfe-commits
mailing list