================
@@ -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 &&
+        (NewFD->getTemplateSpecializationKind() == TSK_ExplicitSpecialization 
||
+         NewFD->getTemplateSpecializationKind() == TSK_Undeclared)) {
----------------
erichkeane wrote:

What is going on here?  Why do you not need to handle 
`TSK_ExplicitInstantiationDeclaration` and 
`TSK_ExplicitInstantiationDefinition`?  Can you play with examples a bit more 
to see if/when those should be applied?


https://github.com/llvm/llvm-project/pull/145272
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to