Quantcast
Viewing all articles
Browse latest Browse all 1175

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


Viewing all articles
Browse latest Browse all 1175

Trending Articles



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