i have a simple function like this in a test.h header
template <class Dst = std::string, class T>
Dst format(const T&);
template <class Dst, Class T>
Dst format(const T&)
{
return Dst();
}
in test.cpp
#include "stdafx.h"
#include "test.h"
#include <iostream>
int main(int argc , char** argv)
{
std::string f = format("");
std::cout << f;
return 0;
}
if this header is added to the precompiled header in xcode
the code does not compile any more .
I get a "no matching function call" error.
if i manually add the default parameter to the function call
format<std::string>();
then it works.
if instead of a declaration and a definition i leave only the definition ...it compiles.