Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
31 Views

Pack argument function overload specialization missing arguments not diagnosed

#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
1 Reply
Highlighted
Moderator
31 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