[Bug c++/51314] New: sizeof... and parentheses

marc.glisse at normalesup dot org gcc-bugzilla@gcc.gnu.org
Sat Nov 26 16:54:00 GMT 2011


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

             Bug #: 51314
           Summary: sizeof... and parentheses
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: marc.glisse@normalesup.org


Hello,

in some cases, g++ accepts sizeof...U (without parentheses) and in some other
cases it doesn't. I was going to report the case where it doesn't as a bug, but
after a look at the standard, it looks like it should always require the
parentheses. Well, I am not so sure, so here is one example of each:

template<int>struct A{};
template<class...U>void f(U...){
    A<sizeof...U> x; // template argument 1 is invalid
}


template<int...> struct Indices;
template<class> struct Next_increasing_indices;
template<int...I> struct Next_increasing_indices<Indices<I...> > {
    typedef Indices<I...,sizeof...I> type; // OK
};



More information about the Gcc-bugs mailing list