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

Pack argument function overload specialization missing arguments not diagnosed

Tambre__Raul
Beginner
788 Views
#include <string>

extern void use(int);

template<class... Ts>
void f(int i=1, Ts... ts)
{
	use(sizeof...(Ts));
}

template<>
void f<std::string>(int i, std::string j)
{
	use(j.size());
}

void test1()
{
	f<std::string>();
}

Godbolt
With -std=c++17 -O2 this compiles to std::abort().
I believe this should fail to compile due to none of the required parameters for the std::string specialization not being given.

Related C++ Defect Reports:
DR777
DR2233

0 Kudos
2 Replies
RahulV_intel
Moderator
788 Views

Hi,

Thanks for raising this issue. I've gone through the links provided. Ideally, as per the latest standard, ICPC should've thrown compilation error, but its not. 

We will escalate this issue to the concerned team, referring to the latest C++ standards(DR777, DR2233).

 

--Rahul

0 Kudos
PrasanthD_intel
Moderator
593 Views

Hi Raul,


The version against which you reported your issue is no longer targeted for fixes. Please check out the new versions of Intel oneAPI Toolkits for the latest features..

We will no longer respond to this thread. If you require additional assistance from Intel, please start a new thread. Any further interaction in this thread will be considered community only.


Regards

Prasanth


0 Kudos
Reply