[PATCH] D13357: [Concepts] Diagnose when 'concept' is specified on a specialization
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 22 14:22:28 PST 2015
rsmith added inline comments.
================
Comment at: include/clang/AST/DeclTemplate.h:836
@@ -835,2 +835,3 @@
+ bool IsConcept : 1;
protected:
----------------
This might make more sense on `TemplateDecl`, since we also want this flag for `VarTemplateDecl`s. In any case, please use some existing spare bit for this rather than making all `FunctionTemplateDecl`s 8 bytes larger by putting it here.
================
Comment at: include/clang/AST/DeclTemplate.h:986
@@ +985,3 @@
+ bool isConcept() const { return IsConcept; }
+ void setConcept(bool IC) { IsConcept = IC; }
+
----------------
Do we need a setter for this? (Can it change after the decl is constructed?)
================
Comment at: lib/Sema/SemaDecl.cpp:7681
@@ +7680,3 @@
+ Diag(D.getDeclSpec().getConceptSpecLoc(),
+ diag::err_concept_specified_specialization) << 1;
+ }
----------------
Yes, I think that's a reasonable way forward. You can change either `TemplatedDecl` or `TemplateParams` into a `PointerIntPair` to avoid making `TemplateDecl` larger.
================
Comment at: lib/Sema/SemaTemplate.cpp:7672-7674
@@ +7671,5 @@
+ // applied only to the definition of a function template or variable template,
+ // declared in namespace scope. A concept definition refers to either a
+ // function concept and its definition or a variable concept and its
+ // initializer.
+ if (D.getDeclSpec().isConceptSpecified()) {
----------------
I don't think we need to quote the second sentence here.
================
Comment at: lib/Sema/SemaTemplate.cpp:7677
@@ +7676,3 @@
+ Diag(D.getDeclSpec().getConceptSpecLoc(),
+ diag:: err_concept_specified_specialization) << 0;
+ return true;
----------------
No space after `::`
http://reviews.llvm.org/D13357
More information about the cfe-commits
mailing list