wc-duck / datalibrary

Open Source Data Library for data serialization.
Other
42 stars 8 forks source link

error C2024: 'alignas' attribute applies to variables, data members and tag types only #43

Closed Srekel closed 8 years ago

Srekel commented 8 years ago

Getting this compile error with VS 2015 on the following generated code:

struct resource_array
{
#if defined( __cplusplus )
    static const uint32_t TYPE_ID = 0xE9279B86;
#endif // defined( __cplusplus )

    struct
    {
        const char** data;
        uint32_t count;
    #if defined( __cplusplus )
              const char*& operator[] (size_t index)       { return data[index]; }
        const char*& operator[] (size_t index) const { return data[index]; }
    #endif // defined( __cplusplus )
    } file;
    struct
    {
        DL_ALIGN(8) uint64_t* data;
        uint32_t count;
    #if defined( __cplusplus )
              DL_ALIGN(8) uint64_t& operator[] (size_t index)       { return data[index]; }
        const DL_ALIGN(8) uint64_t& operator[] ( size_t index ) const { return data[index]; }
    #endif // defined( __cplusplus )
    } id;
    int32_t max; 
};

Specifically lines like this:

DL_ALIGN(8) uint64_t& operator[](size_t index) { return data[index]; }

wc-duck commented 8 years ago

Yes that looks knd of iffy. I guess that the DL_ALIGN is not needed on operator[]. I don't think I'll have time to fix it today, but hopefully tomorrow night.

wc-duck commented 8 years ago

I just submitted a fix... not tested since I have no access to MSVC 2015 right now... but it "should" work :) Feel free to close the issue if it solves your problem.

wc-duck commented 8 years ago

Did the fix work for your?

lundmark commented 8 years ago

He hasn't tried it out yet. He got the VIVE on monday so he's all gulped up in the VR-world :(

wc-duck commented 8 years ago

I'll assume this is fixed ;)

lundmark commented 8 years ago

Yes go ahead and assume that. We'll reopen it if we discover any issues hehe :P