| 1 |
// { dg-do compile } |
| 2 |
// { dg-require-effective-target c++14 } |
| 3 |
// { dg-options "-O2 -ffinite-math-only -fdump-tree-fre1" } |
| 4 |
|
| 5 |
#include <array> |
| 6 |
|
| 7 |
struct I { double i,s; I(double d):i(d),s(d){} }; |
| 8 |
typedef std::array<double,3> P; |
| 9 |
typedef std::array<I,3> AP; |
| 10 |
|
| 11 |
static AP c(P const&p){ |
| 12 |
return {p[0],p[1],p[2]}; |
| 13 |
} |
| 14 |
template<class T> auto const& ac(T const&p, int n){return p[n];} |
| 15 |
static double g(P const&p, int n) |
| 16 |
{ |
| 17 |
I res = ac(c(p),n); |
| 18 |
return res.s-res.i; |
| 19 |
} |
| 20 |
|
| 21 |
__attribute__((flatten)) double fff(P p){ return g(p,1); } |
| 22 |
|
| 23 |
// { dg-final { scan-tree-dump "return 0.0;" "fre1" } } |