OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.dg/] [other/] [pr30567.C] - Blame information for rev 149

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* { dg-do run } */
2
/* { dg-options "-O -finline-functions -fstrict-aliasing" } */
3
 
4
template 
5
struct const_ref
6
{
7
  const T* begin;
8
  const_ref(const T* b) : begin(b) {}
9
};
10
 
11
template 
12
T sum(const_ref const& a)
13
{
14
  T result = 0;
15
  for(unsigned i=0;i<1;i++) result += a.begin[i];
16
  return result;
17
}
18
 
19
struct tiny_plain
20
{
21
  int elems[2];
22
  tiny_plain() { elems[0]=1; }
23
};
24
 
25
struct vec3 : tiny_plain {};
26
 
27
struct mat3
28
{
29
  int type() const { return sum(const_ref(vec3().elems)) == 1; }
30
};
31
 
32
int main() { return mat3().type() ? 0 : 1; }
33
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.