Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

Weird error with variadic parameter pack expansion in constructor

Raffael_C_
Beginner
414 Views

Hi,

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

[cpp]

#include<memory>

struct CompositeGrid {

    template<class... GRID_IMPL>

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

    }

};

int main() {

  CompositeGrid a(std::shared_ptr<int>(new int(5)));

}

[/cpp]

However this fails with the following error message:

[cpp]

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)  {

[/cpp]

 

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.

Cheers,

Raffael

0 Kudos
2 Replies
Judith_W_Intel
Employee
414 Views

 

Hello Raffael,

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

http://software.intel.com/en-us/forums/topic/501502

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

Sorry for the trouble!

Judy

 

 

0 Kudos
Raffael_C_
Beginner
414 Views

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:)

Raffael

0 Kudos
Reply