view gcc/testsuite/g++.dg/tree-ssa/pr78847.C @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 04ced10e8804
children
line wrap: on
line source

/* { dg-do compile } */
/* { dg-require-effective-target c++14 } */
/* { dg-options "-O3 -fdump-tree-ldist-optimized" } */

#include <stddef.h>
#include <cstring>
#include <experimental/string_view>

using string_view = std::experimental::string_view;

class Foo {
    constexpr static size_t Length = 9;
    char ascii_[Length];
public:
    Foo();
    string_view view() const {
	return string_view(ascii_, Length);
    }
};

void testWithLoopValue(const Foo foo, size_t ptr, char *buf_) {
    for (auto c : foo.view())
      buf_[ptr++] = c;
}

/* { dg-final { scan-tree-dump "split to 0 loops and 1 library calls" "ldist" } } */