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

            Bug ID: 57673
           Summary: pack sizeof ... groups ellipsis with preceding
                    expression
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: potswa at mac dot com

In this example, template g compiles without issue but each member in d chokes
the parser. The only difference is grouping parentheses, which shouldn't be
significant.

There may be more than one issue. A left paren seems to get the parser into a
good state to accept sizeof ... , but it starts in a bad state at the beginning
of an initializer, and seeing a qualified-id puts it into a bad state.
(Reversing the order of subexpressions and writing ( sizeof ... ( p ) - i::m )
does not produce an error.)


struct i { static constexpr int m = 5; };

template< int ... p >
struct g {
    static constexpr int m = i::m - ( sizeof ... ( p ) );
    int n = ( sizeof ... ( p ) );
};

template< int ... p >
struct d {
    static constexpr int m = ( i::m - sizeof ... ( p ) );
    int n = sizeof ... ( p );
};

Reply via email to