1

VES2008 に対して Greta をコンパイルしたところ、報告されました

error C2332: 'class' : missing tag name                                           
error C3306: 'regex::detail::<unnamed-tag>': unnamed class template is not allowed
error C2143: syntax error : missing ';' before '__builtin_alignof'                
error C2059: syntax error : '__builtin_alignof'                                   
error C2143: syntax error : missing ';' before '{'                                
error C2447: '{' : missing function header (old-style formal list?)               

関連するソース コード スニペット:

template< typename T >
class alignof
{
    struct helper
    {
        helper();
        char    m_c;
        T       m_t;
    };
public:
    enum { value = sizeof(helper)-sizeof(T) < sizeof(T) ? sizeof(helper)-sizeof(T) : sizeof(T) };
};

プリコンパイル後、

template< typename T >
class __alignof
{
    struct helper
    {
        helper();
        char    m_c;
        T       m_t;
    };
public:
    enum { value = sizeof(helper)-sizeof(T) < sizeof(T) ? sizeof(helper)-sizeof(T) : sizeof(T) };
};

グーグルで検索しても答えが見つかりません。これを引き起こした原因と解決方法は?

4

1 に答える 1

0

alignofVS2008 では予約語ではないようですが、非常に似ているため、_alignof問題が混乱する可能性があります。

クラスの名前を別のものに変更してみてください。

于 2013-04-09T05:03:20.923 に答える