[PATCH] D11027: [CONCEPTS] Creating Diagnostics for ill-formed function concept declaration

Hubert Tong hubert.reinterpretcast at gmail.com
Wed Jul 8 22:39:30 PDT 2015


hubert.reinterpretcast added inline comments.

================
Comment at: lib/Sema/SemaDecl.cpp:7447
@@ +7446,3 @@
+      // template, declared in namespace scope
+      if (!NewFD->getParent()->getRedeclContext()->isFileContext()) {
+        Diag(D.getIdentifierLoc(), diag::err_invalid_concept_scope);
----------------
nwilson wrote:
> Any thoughts about moving this check? I think it can be moved above to inside HandleDeclarator before we look at acting on a function or variable declarator since this check is applicable to both a function and variable concept
> 
> Something like:
> if (!D.getContext() == FileContext) {
>   Diag(...)
> }
You would need to use `DC`. The `DeclContext` is also adjusted "later" by `adjustContextForLocalExternDecl` in each of the function and variable cases. I'm not sure what happens with friend declarations. In this case, I think using `DC` before the adjustments makes sense (since we cannot declare a concept in block scope or as a friend).


http://reviews.llvm.org/D11027







More information about the cfe-commits mailing list