0 not a valid FILE* when provided as a template argument
Posted
by Seva Alekseyev
on Stack Overflow
See other posts from Stack Overflow
or by Seva Alekseyev
Published on 2010-03-30T21:30:03Z
Indexed on
2010/03/30
21:33 UTC
Read the original article
Hit count: 336
The following code
#include <stdio.h>
template <typename T, T v> class Tem
{
T t;
Tem()
{
t = v;
}
};
typedef Tem<FILE*,NULL> TemFile;
when compiled in a .mm file (Objective C++) by Xcode on MacOS X, throws the following error:
error: could not convert template argument '0' to 'FILE*'.
What's going on, please? The code in question compiled fine under MSVC. Since when is the 0 constant not a valid pointer to anything? Is this an artifact of Objective C++ (as opposed to vanilla C++)?
© Stack Overflow or respective owner