This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/50140] New: sorry, unimplemented: cannot expand âT ...â into a fixed-length argument list


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50140

             Bug #: 50140
           Summary: sorry, unimplemented: cannot expand âT ...â into a
                    fixed-length argument list
    Classification: Unclassified
           Product: gcc
           Version: 4.5.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: lcid-fire@gmx.net


Trying to use metaprogramming with variadic templates g++ chokes on the
following code:

template<GLenum One, GLenum... Others>
class Eval
{
public:
    bool eval(GLenum value)
    {
        if( value == One )
            return true;

        Eval<Others...> recurse();
        // Try out the rest
        return recurse.eval(value);
    };
};

template<>
class Eval
{
public:
    bool eval(GLenum value)
    {
        return false;
    };
};

template<GLenum... ValidEnums>
class GLPart
{
protected:
    GLPart()
    {
    };
public:
    bool Evaluate(GLenum value)
    {
        Eval<ValidEnums...> ev();
        bool isValid = ev.eval(value);

        if( !isValid )
            glSetError(GL_INVALID_ENUM);

        return isValid;
    };
};

which gives the error:
sorry, unimplemented: cannot expand âOthers ...â into a fixed-length argument
list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]