Baz
Baz

Reputation: 13185

incorrect argument to 'decltype'

template<class T>
std::vector<T> convert(int argument)
{
}

int main()
{
  decltype(&convert<int>);
  return 0;
}

The following gives this error for Visual Studio 2010:

error C3555: incorrect argument to 'decltype'

Why?

I'm tring to create a std::map where the key is an enum and the value is a function.

Upvotes: 6

Views: 1172

Answers (1)

MSalters
MSalters

Reputation: 180305

VS2010 bug. That link also has a workaround:

template <typename T> T identity(T);
decltype(identity(&convert<int>));

Upvotes: 9

Related Questions