[PATCH] D19322: Concepts: Create space for requires-clause in TemplateParameterList; NFC

Hubert Tong via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 29 06:52:57 PDT 2016


hubert.reinterpretcast added inline comments.

================
Comment at: include/clang/AST/DeclTemplate.h:175
@@ -152,2 +174,3 @@
+  Expr *RequiresClause;
 
 public:
----------------
faisalv wrote:
> Yuk - this entire guy (FizedSizeTemplateParameterListStorage) seems quite fragile (dependent on object layout) - are the gains (in the single use below during auto-type deduction) in preformance really worth the introduction of this fragility/ugliness? 
> Unless there is a clear win from this strategy, I think i'd favor (perhaps in a later patch) - either just removing this structure and using TPL for the use-case in auto-type below, or using placement new and creating the stack TPL on a stack unsigned char array?
> Thoughts?
> 
I don't like the class here either; however, I would not like to introduce heap allocation just to remove it. placement-new is certainly part of the solution. I think that `TrailingObjects` should have an alias for a type that can be used as aligned storage (templated in the style of `totalSizeToAlloc`). I would like to keep that endeavour to a separate patch though.


http://reviews.llvm.org/D19322





More information about the cfe-commits mailing list