PR tree-optimization/86415 - strlen() not folded for substrings within constant arrays
[official-gcc.git] / gcc / testsuite / g++.dg / pr61094.C
blob35adc256c218cdff89047ae7855ef47c370df12b
1 /* { dg-do compile } */
2 /* { dg-options "-O3" }  */
4 template <typename> struct A {
5   unsigned _width, _height, _depth, _spectrum;
6   template <typename t> A(t p1) {
7     int a = p1.size();
8     if (a) {
9       _width = p1._width;
10       _depth = _height = _spectrum = p1._spectrum;
11     }
12   }
13   long size() { return (long)_width * _height * _depth * _spectrum; }
16 int d;
17 void fn1(void *);
18 A<int> *fn2();
19 void fn3() {
20   int b;
21   for (;;) {
22     A<char> c(*fn2());
23     fn1(&c);
24     if (d || !b)
25       throw;
26   }