c++ - Template error C2244 unable to match function definition to an existing declaration using constexpr in Microsoft Visual Studio 2015 -
i'm getting : error c2244 unable match function definition existing declaration while using constexpr.
template<int n> constexpr int x() { return n*n; } template<int x, int n> class b { public: int data; }; template<int n> class { public: int f(b<x<n>(), n> b); }; template<int n> int a<n>::f(b<x<n>(), n> b) { return b.data; } int main() { a<10> a; return 0; }
if remove constexpr function , replace expression n*n, works fine.
gnu c++ compiles , expect, according https://msdn.microsoft.com/en-us/library/hh567368.aspx, constexpr works correctly on visual studio 2015.
Comments
Post a Comment