[PATCH] D13357: [Concepts] Diagnose when 'concept' is specified on a specialization
Hubert Tong via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 28 15:45:27 PDT 2015
hubert.reinterpretcast added inline comments.
Comment at: include/clang/AST/Decl.h:1577
@@ -1576,2 +1576,3 @@
bool IsConstexpr : 1;
+ bool IsConcept : 1;
> faisalv wrote:
> > My inclination would have been to add this bit to FunctionTemplateDecl, instead of to every FunctionDecl - since not every kind of FunctionDecl can be a concept ... My first instinct would have been to add an enum to TemplateKind, and then forward isConcept() to check if we are a template and if so, through it, if concept is specified?
> > But I suppose that adds more complexity, and you trade space for speed - For my own edification, could I ask you or Richard to comment on the cons of that approach - and why the current approach is preferred? (i.e. simplicity over complexity or space over time etc.)
> Sorry for the slow reply. Yeah, I thought it was a little more straightforward having isConcept as a member function of FunctionDecl (and the bit). It also seemed that we'd be okay in terms of size since 17 bits are already being used here and adding one more wouldn't go over a byte boundary. Maybe Richard has other thoughts though?
I am not sure what the original justification was for IsTrivial to be a bit here instead of in CXXMethodDecl, but it seems that similar considerations apply.
Comment at: lib/Sema/SemaDecl.cpp:5909
@@ +5908,3 @@
+ << (IsPartialSpecialization ? 2 : 1);
Should we mention that the partial specialization case is pending additional wording (under Concepts TS Issue 15)?
More information about the cfe-commits