MSVC instantiation issue

me 1 Reputation point
2020-06-02T02:53:40.897+00:00
#include <cstddef>
#include <array>
#include <functional>
#include <bitset>
#include <limits>
#include <iostream>
#include <thread>

template < class Type > void* my_function ( void* ) {
    return 0;
};

template < std::uint8_t N >
struct my_other_type {
    static bool compare ( std::uint8_t i ) { return i == N; };
};

template < class MyType >
struct my_type {
    static bool compare ( std::uint8_t i ) { return MyType::compare ( i ); };
};

union section_entry {
    void* ( *Lambda )( void* );
    void* Out;
};

template < class Type >
struct section_function {
#pragma section("my_section",read,write)
    static inline section_entry Entry { [ ] ( void* n ) -> void* { return my_function < Type > ( n ); } };
};

// 'section_function <my_type<my_other_type<0x00>>>::<lambda_1>' is not a template-class specialization
template struct section_function < my_type < my_other_type < 0x00 > > >; // C2946.

int main()
{
    section_function < my_type < my_other_type < 0x01 > > > M;

    std::cout << M.Entry.Out;

    std::cout << "Hello, world!\n";
}
Not Monitored
Not Monitored
Tag not monitored by Microsoft.
36,281 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Dave Patrick 426.1K Reputation points MVP
    2020-06-02T02:55:17.047+00:00

    MSVC is not currently supported here on QnA. I'd try asking for help in dedicated forums here.

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=vcgeneral

    --please don't forget to Accept as answer if the reply is helpful--


    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows Server] Datacenter Management

    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees, and confers no rights.

    0 comments No comments