MSVC instantiation issue

asked 2020-06-02T02:53:40.897+00:00
me 1 Reputation point
#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.
23,664 questions
No comments
{count} votes

1 answer

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

    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.

    No comments