2018-11-07 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / g++.dg / torture / pr30567.C
blob389daf357840e496be127a740012c56a62368399
1 /* { dg-do run } */
3 template <typename T>
4 struct const_ref
6   const T* begin;
7   const_ref(const T* b) : begin(b) {}
8 };
10 template <typename T>
11 T sum(const_ref<T> const& a)
13   T result = 0;
14   for(unsigned i=0;i<1;i++) result += a.begin[i];
15   return result;
18 struct tiny_plain
20   int elems[2];
21   tiny_plain() { elems[0]=1; }
24 struct vec3 : tiny_plain {};
26 struct mat3
28   int type() const { return sum(const_ref<int>(vec3().elems)) == 1; }
31 int main() { return mat3().type() ? 0 : 1; }