https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68703

            Bug ID: 68703
           Summary: __attribute__((vector_size(N))) template member
                    confusion
           Product: gcc
           Version: 5.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ncm at cantrip dot org
  Target Milestone: ---

$ cat vs2.cc
template <int N = 4>
struct D { 
    int v//[N]
        __attribute__((vector_size(N * sizeof(int))));
    int f1() { return this->v[N-1]; }
    int f2() { return v[N-1]; }
};

int main(int ac, char**)
{
  D<> d = { { ac } };
  return d.f1() + d.f2();
}

$ g++ vs2.cc
vs2.cc: In member function ‘int D<N>::f2()’:
vs2.cc:6:28: error: invalid types ‘int[int]’ for array subscript
     int f2() { return v[N-1]; }
                            ^

Notice that f1, with "this->", is OK.

Reply via email to