Weird error with variadic parameter pack expansion in constructor

Weird error with variadic parameter pack expansion in constructor


I try to compile the following code on windows, Intel Compiler XE 2014 Update 1:

struct CompositeGrid {
    template<class... GRID_IMPL>
    CompositeGrid(std::shared_ptr<GRID_IMPL>... gridImpls)  {    
int main() {
  CompositeGrid a(std::shared_ptr<int>(new int(5)));

However this fails with the following error message:

parameterPackExpansion.cpp(5): error: parameter pack "GRID_IMPL" was referenced
but not expanded CompositeGrid(std::shared_ptr<GRID_IMPL>... gridImpls)  {
parameterPackExpansion.cpp(5): error: pack expansion does not make use of any argument packs

	      CompositeGrid(std::shared_ptr<GRID_IMPL>... gridImpls)  {


I think this is a bug since it compiles sucessfully on gcc 4.8.2. and clang 3.4 (under linux). Weirdly enough the bug is resolved if the Constructor takes an additional, non-variadic first argument.



3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.


Hello Raffael,

I believe this is the same problem as described in this note:

Please see my reply there for a description of the bug and a suggested workaround.

Sorry for the trouble!




Hi Judy,

Thanks a lot, the problem that you mentioned is indeed very similar. I actually read that post before I posted mine because I was not sure that it is exactly the same. For me the difference is that in my case the constructor is a template in a usual class whereas in the case of Steffan it is a usual constructor in a class template (with variadic templates).

I just hope it will be fixed in one of the upcoming releases, util then I can emply the workaround:)


Leave a Comment

Please sign in to add a comment. Not a member? Join today