Quantcast
Channel: Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1616

Weird error with variadic parameter pack expansion in constructor

$
0
0

Hi,

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

#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)));
}

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.

Cheers,

Raffael


Viewing all articles
Browse latest Browse all 1616

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>