1 // RUN: %clang_cc1 -fsyntax-only -std=c++11 -Wloop-analysis -verify %s
2 // RUN: %clang_cc1 -fsyntax-only -std=c++11 -Wrange-loop-analysis -verify %s
4 void test_POD_64_bytes() {
10 for (const auto r
: records
)
14 void test_POD_65_bytes() {
19 // expected-warning@+3 {{loop variable 'r' creates a copy from type 'const Record'}}
20 // expected-note@+2 {{use reference type 'const Record &' to prevent copying}}
22 for (const auto r
: records
)
26 void test_TriviallyCopyable_64_bytes() {
33 for (const auto r
: records
)
37 void test_TriviallyCopyable_65_bytes() {
43 // expected-warning@+3 {{loop variable 'r' creates a copy from type 'const Record'}}
44 // expected-note@+2 {{use reference type 'const Record &' to prevent copying}}
46 for (const auto r
: records
)
50 void test_NonTriviallyCopyable() {
58 // expected-warning@+3 {{loop variable 'r' creates a copy from type 'const Record'}}
59 // expected-note@+2 {{use reference type 'const Record &' to prevent copying}}
61 for (const auto r
: records
)
65 void test_TrivialABI_64_bytes() {
66 struct [[clang::trivial_abi
]] Record
{
73 for (const auto r
: records
)
77 void test_TrivialABI_65_bytes() {
78 struct [[clang::trivial_abi
]] Record
{
84 // expected-warning@+3 {{loop variable 'r' creates a copy from type 'const Record'}}
85 // expected-note@+2 {{use reference type 'const Record &' to prevent copying}}
87 for (const auto r
: records
)