The attached patch is an aborted attempt to implement support for code such as

  template<typename ...Types>
  struct X {
        template<Types ...Values>
        struct Y { /* whatever */ };
  };

where the type of a non-type template parameter pack is a pack expansion. 
Therefore, for example, X<short, int, long>::Y would effectively have three 
non-type template parameters, with types 'short', 'int', and 'long', 
respectively.

This implementation attempted to address this problem by instantiating 'Values' 
into three separate non-type template parameters, then keeping around a mapping 
from those instantiated non-type template parameters back to the parameter 
pack. However, doing so meant that these parameters had a strange existence, 
being neither a real parameter pack nor a real parameter, and this dual role 
broke many invariants expected of Sema and the AST. Thus, I'm sending this 
failed attempt to cfe-commits to remind myself not to do it again

I plan to attempt a completely different approach, which keeps 'Values' as a 
parameter pack whose "type" is just a placeholder storing N different types. 
It'll require updates to more code, and NonTypeTemplateParmDecl::getType() 
won't make sense for such parameter packs, but it should maintain the AST and 
Sema invariants better.

        - Doug

Attachment: non-type-template-parameter-of-pack-expansion-type.patch
Description: Binary data

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to