[clang] [clang][FMV] Allow declaration of function versions in namespaces. (PR #93044)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Wed May 22 12:20:43 PDT 2024


================
@@ -11868,8 +11868,10 @@ static bool CheckMultiVersionFunction(Sema &S, FunctionDecl *NewFD,
     return false;
 
   if (!OldDecl || !OldDecl->getAsFunction() ||
-      OldDecl->getDeclContext()->getRedeclContext() !=
-          NewFD->getDeclContext()->getRedeclContext()) {
+      (OldDecl->getDeclContext()->getRedeclContext() !=
+           NewFD->getDeclContext()->getRedeclContext() &&
+       OldDecl->getDeclContext()->getEnclosingNamespaceContext() !=
+           NewFD->getDeclContext()->getEnclosingNamespaceContext())) {
----------------
efriedma-quic wrote:

```suggestion
      !OldDecl->getDeclContext()->getRedeclContext()->Equals(
          NewFD->getDeclContext()->getRedeclContext())) {
```

https://github.com/llvm/llvm-project/pull/93044


More information about the cfe-commits mailing list