question

me-5878 avatar image
0 Votes"
me-5878 asked ·

MSVC instantiation issue


 #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-supported
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

DSPatrick avatar image
0 Votes"
DSPatrick answered ·

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.







·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.