Not Monitored
Tag not monitored by Microsoft.
41,671 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
#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";
}
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.