[PATCH] D153542: [C++20][Modules] Implement P2615R1 exported specialization diagnostics.

Chuanqi Xu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 26 19:04:25 PDT 2023


ChuanqiXu added inline comments.


================
Comment at: clang/lib/Sema/SemaModule.cpp:848-849
+    if (auto *FD = dyn_cast<FunctionDecl>(D)) {
+      if (FD->getTemplateSpecializationKind() == TSK_ExplicitSpecialization)
+        BadExport = true;
+    } else if (auto *VD = dyn_cast<VarDecl>(D)) {
----------------
iains wrote:
> ChuanqiXu wrote:
> > Given P2615R1 doesn't allow explicit-instantiation in export block too.
> I think I must be missing something - I do not see that in the paper - please could you expand your comment?
See the proposed change in #[module.interface]p1 in the paper, it changed:

```
export declaration
```

to 


```
export named-declaration
```

And the change between the old declaration and the new named declaration is in the proposed change in #[dcl.pre]p1. So it shows the special declarations shouldn't be allowed after `export`.

Also I noted it is allowed to write `export { declaration-seq_opt }` where the `declaration-seq` may contain special declarations. It looks weird to me. I'll try to check it and ask WG21 when necessary.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153542/new/

https://reviews.llvm.org/D153542



More information about the cfe-commits mailing list