From e00dfa841f28206591d0276d83804fa6e2739dce Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Sat, 8 Sep 2018 14:27:25 +0000 Subject: [PATCH] array-init.c: Add dg-prune-output. * c-c++-common/array-init.c: Add dg-prune-output. * g++.dg/cpp0x/lambda/lambda-const-this.C: Add dg-warning. * g++.dg/cpp0x/lambda/lambda-in-class-neg.C: Likewise. * g++.dg/cpp0x/lambda/lambda-in-class.C: Likewise. * g++.dg/cpp0x/lambda/lambda-nested.C: Likewise. * g++.dg/cpp0x/lambda/lambda-nsdmi1.C: Likewise. * g++.dg/cpp0x/lambda/lambda-nsdmi4.C: Likewise. * g++.dg/cpp0x/lambda/lambda-this.C: Likewise. * g++.dg/cpp0x/lambda/lambda-this17.C: Likewise. * g++.dg/cpp0x/lambda/lambda-this18.C: Likewise. * g++.dg/cpp0x/lambda/lambda-this2.C: Likewise. * g++.dg/cpp0x/lambda/lambda-this8.C: Likewise. * g++.dg/cpp1y/pr64382.C: Likewise. * g++.dg/cpp1y/pr77739.C: Likewise. * g++.dg/cpp1z/lambda-this1.C: Likewise. * g++.dg/cpp1z/lambda-this2.C: Likewise. * g++.dg/template/crash84.C: Adjust dg-error. From-SVN: r264169 --- gcc/testsuite/ChangeLog | 20 +++++++++++++++++++ gcc/testsuite/c-c++-common/array-init.c | 1 + .../g++.dg/cpp0x/lambda/lambda-const-this.C | 1 + .../g++.dg/cpp0x/lambda/lambda-in-class-neg.C | 3 ++- .../g++.dg/cpp0x/lambda/lambda-in-class.C | 3 ++- .../g++.dg/cpp0x/lambda/lambda-nested.C | 2 +- .../g++.dg/cpp0x/lambda/lambda-nsdmi1.C | 2 +- .../g++.dg/cpp0x/lambda/lambda-nsdmi4.C | 2 +- .../g++.dg/cpp0x/lambda/lambda-this.C | 3 ++- .../g++.dg/cpp0x/lambda/lambda-this17.C | 2 +- .../g++.dg/cpp0x/lambda/lambda-this18.C | 2 +- .../g++.dg/cpp0x/lambda/lambda-this2.C | 2 +- .../g++.dg/cpp0x/lambda/lambda-this8.C | 8 ++++---- gcc/testsuite/g++.dg/cpp1y/pr64382.C | 2 +- gcc/testsuite/g++.dg/cpp1y/pr77739.C | 2 +- gcc/testsuite/g++.dg/cpp1z/lambda-this1.C | 6 +++--- gcc/testsuite/g++.dg/cpp1z/lambda-this2.C | 8 ++++---- gcc/testsuite/g++.dg/template/crash84.C | 2 +- 18 files changed, 48 insertions(+), 23 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5357856c464..15e3979fae1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,23 @@ +2018-09-08 Marek Polacek + + * c-c++-common/array-init.c: Add dg-prune-output. + * g++.dg/cpp0x/lambda/lambda-const-this.C: Add dg-warning. + * g++.dg/cpp0x/lambda/lambda-in-class-neg.C: Likewise. + * g++.dg/cpp0x/lambda/lambda-in-class.C: Likewise. + * g++.dg/cpp0x/lambda/lambda-nested.C: Likewise. + * g++.dg/cpp0x/lambda/lambda-nsdmi1.C: Likewise. + * g++.dg/cpp0x/lambda/lambda-nsdmi4.C: Likewise. + * g++.dg/cpp0x/lambda/lambda-this.C: Likewise. + * g++.dg/cpp0x/lambda/lambda-this17.C: Likewise. + * g++.dg/cpp0x/lambda/lambda-this18.C: Likewise. + * g++.dg/cpp0x/lambda/lambda-this2.C: Likewise. + * g++.dg/cpp0x/lambda/lambda-this8.C: Likewise. + * g++.dg/cpp1y/pr64382.C: Likewise. + * g++.dg/cpp1y/pr77739.C: Likewise. + * g++.dg/cpp1z/lambda-this1.C: Likewise. + * g++.dg/cpp1z/lambda-this2.C: Likewise. + * g++.dg/template/crash84.C: Adjust dg-error. + 2018-09-07 Marek Polacek * g++.dg/cpp1z/direct-enum-init1.C: Remove "inside" from diagnostic diff --git a/gcc/testsuite/c-c++-common/array-init.c b/gcc/testsuite/c-c++-common/array-init.c index 0624e708987..3cc5722ea75 100644 --- a/gcc/testsuite/c-c++-common/array-init.c +++ b/gcc/testsuite/c-c++-common/array-init.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ /* { dg-prune-output "sorry, unimplemented: non-trivial designated initializers not supported" } */ +/* { dg-prune-output "all initializer clauses should be designated" } */ char x[] = { [-1] = 1, 2, 3 }; /* { dg-error "array index in initializer exceeds array bounds" "" { target c } } */ diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-const-this.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-const-this.C index 220ac911cdb..f51055d6e7d 100644 --- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-const-this.C +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-const-this.C @@ -5,5 +5,6 @@ struct S { void f(); void g() const { [=] { f(); } (); // { dg-error "no match|qualifiers" } +// { dg-warning "implicit capture" "" { target c++2a } .-1 } } }; diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-in-class-neg.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-in-class-neg.C index 92a165d95bb..cff3d375682 100644 --- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-in-class-neg.C +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-in-class-neg.C @@ -18,8 +18,9 @@ class C { [&] () -> void { this->m_i = 3; } (); assert(m_i == 3); [=] () -> void { m_i = 4; } (); // copies 'this' or --copies-m_i--? +// { dg-warning "implicit capture" "" { target c++2a } .-1 } assert(m_i == 4); - [=] () -> void { this->m_i = 5; } (); + [=] () -> void { this->m_i = 5; } (); // { dg-warning "implicit capture" "" { target c++2a } } assert(m_i == 5); } diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-in-class.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-in-class.C index 92981109fd8..f2b54e58ad3 100644 --- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-in-class.C +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-in-class.C @@ -18,8 +18,9 @@ class C { [&] () -> void { this->m_i = 3; } (); assert(m_i == 3); [=] () -> void { m_i = 4; } (); // copies 'this' or --copies-m_i--? +// { dg-warning "implicit capture" "" { target c++2a } .-1 } assert(m_i == 4); - [=] () -> void { this->m_i = 5; } (); + [=] () -> void { this->m_i = 5; } (); // { dg-warning "implicit capture" "" { target c++2a } } assert(m_i == 5); } diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested.C index c8ea46a980f..3848938d55f 100644 --- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested.C +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested.C @@ -7,7 +7,7 @@ struct A { A(): i(42) { } int f() { return [this]{ - return [=]{ return i; }(); + return [=]{ return i; }(); // { dg-warning "implicit capture" "" { target c++2a } } }(); } }; diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nsdmi1.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nsdmi1.C index 94dc254fd7c..b6972896ecb 100644 --- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nsdmi1.C +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nsdmi1.C @@ -1,7 +1,7 @@ // PR c++/56464 // { dg-do run { target c++11 } } -struct bug { bug*a = [&]{ return [=]{return this;}(); }(); }; +struct bug { bug*a = [&]{ return [=]{return this;}(); }(); }; // { dg-warning "implicit capture" "" { target c++2a } } int main() { bug b; diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nsdmi4.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nsdmi4.C index b592f155063..127bd26b953 100644 --- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nsdmi4.C +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nsdmi4.C @@ -10,5 +10,5 @@ struct function struct testee { function l1 = []() { }; - function l2 = [=]() { l1; }; + function l2 = [=]() { l1; }; // { dg-warning "implicit capture" "" { target c++2a } } }; diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this.C index b32f8d7cc28..7a27cf44a68 100644 --- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this.C +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this.C @@ -6,8 +6,9 @@ struct A int i; void f() { - [=] { i = 0; }; + [=] { i = 0; }; // { dg-warning "implicit capture" "" { target c++2a } } [&] { i = 0; }; [=] { this = 0; }; // { dg-error "lvalue" } +// { dg-warning "implicit capture" "" { target c++2a } .-1 } } }; diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this17.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this17.C index 2386e6b1eb8..b7cdf31c46b 100644 --- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this17.C +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this17.C @@ -7,7 +7,7 @@ struct Test { struct TestPickled : Test { template void triggerTest (Args&&... fargs) { - [=](Args... as) { + [=](Args... as) { // { dg-warning "implicit capture" "" { target c++2a } } Test::triggerTest (as...); } (); } diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this18.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this18.C index fec2da615b6..3cfd3c0f252 100644 --- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this18.C +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this18.C @@ -18,7 +18,7 @@ template void A::bar () { - auto f = [this] () { auto g = [=] () { a.foo (); }; g (); }; + auto f = [this] () { auto g = [=] () { a.foo (); }; g (); }; // { dg-warning "implicit capture" "" { target c++2a } } f (); } diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this2.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this2.C index 5029a4a7638..56d6b0c8ab9 100644 --- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this2.C +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this2.C @@ -7,7 +7,7 @@ struct S1 { int i; void g(); void f() { - [=]() { + [=]() { // { dg-warning "implicit capture" "" { target c++2a } } i; g(); S1::g(); diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this8.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this8.C index d7c5d2c051d..e62cd08a614 100644 --- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this8.C +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this8.C @@ -6,21 +6,21 @@ struct test { template std::function broken(int x) { - return [=] { +x; print(); }; + return [=] { +x; print(); }; // { dg-warning "implicit capture" "" { target c++2a } } } std::function works0() { - return [=] { print(); }; + return [=] { print(); }; // { dg-warning "implicit capture" "" { target c++2a } } } template std::function works1() { - return [=] { print(); }; + return [=] { print(); }; // { dg-warning "implicit capture" "" { target c++2a } } } template std::function works2() { - return [=] { this->print(); }; + return [=] { this->print(); }; // { dg-warning "implicit capture" "" { target c++2a } } } template diff --git a/gcc/testsuite/g++.dg/cpp1y/pr64382.C b/gcc/testsuite/g++.dg/cpp1y/pr64382.C index 8f2e931e048..0342dee7e98 100644 --- a/gcc/testsuite/g++.dg/cpp1y/pr64382.C +++ b/gcc/testsuite/g++.dg/cpp1y/pr64382.C @@ -9,7 +9,7 @@ struct my_queue } void ice() { - auto L = [=](auto &&v) { + auto L = [=](auto &&v) { // { dg-warning "implicit capture" "" { target c++2a } } push(v); }; trav(L); diff --git a/gcc/testsuite/g++.dg/cpp1y/pr77739.C b/gcc/testsuite/g++.dg/cpp1y/pr77739.C index 96183305a7d..8fe76f99f56 100644 --- a/gcc/testsuite/g++.dg/cpp1y/pr77739.C +++ b/gcc/testsuite/g++.dg/cpp1y/pr77739.C @@ -8,7 +8,7 @@ struct A { struct B { B(); template auto g(Args &&... p1) { - return [=] { f(p1...); }; + return [=] { f(p1...); }; // { dg-warning "implicit capture" "" { target c++2a } } } void f(A, const char *); }; diff --git a/gcc/testsuite/g++.dg/cpp1z/lambda-this1.C b/gcc/testsuite/g++.dg/cpp1z/lambda-this1.C index 2c49dd9bf73..b13ff8b9fc6 100644 --- a/gcc/testsuite/g++.dg/cpp1z/lambda-this1.C +++ b/gcc/testsuite/g++.dg/cpp1z/lambda-this1.C @@ -15,7 +15,7 @@ struct A { auto g = [*this] { a++; }; // { dg-error "in read-only object" } // { dg-error "'*this' capture only available with" "" { target c++14_down } .-1 } auto h = [*this] () mutable { a++; };// { dg-error "'*this' capture only available with" "" { target c++14_down } } - auto i = [=] { return a; }; + auto i = [=] { return a; }; // { dg-warning "implicit capture" "" { target c++2a } } auto j = [&] { return a; }; // P0409R2 - C++2A lambda capture [=, this] auto k = [=, this] { return a; };// { dg-error "explicit by-copy capture of 'this' redundant with by-copy capture default" "" { target c++17_down } } @@ -62,7 +62,7 @@ struct C { auto d = [this] { return c; }; auto e = [*this] { return c; }; // { dg-error "use of deleted function" } // { dg-error "'*this' capture only available with" "" { target c++14_down } .-1 } - auto f = [=] { return c; }; + auto f = [=] { return c; }; // { dg-warning "implicit capture" "" { target c++2a } } auto g = [&] { return c; }; auto h = [this] { bar (); }; auto i = [*this] { bar (); }; // { dg-error "use of deleted function" } @@ -77,7 +77,7 @@ struct D { auto e = [this] { return d; }; auto f = [*this] { return d; }; // { dg-error "use of deleted function" } // { dg-error "'*this' capture only available with" "" { target c++14_down } .-1 } - auto g = [=] { return d; }; + auto g = [=] { return d; }; // { dg-warning "implicit capture" "" { target c++2a } } auto h = [&] { return d; }; auto i = [this] { bar (); }; auto j = [*this] { bar (); }; // { dg-error "use of deleted function" } diff --git a/gcc/testsuite/g++.dg/cpp1z/lambda-this2.C b/gcc/testsuite/g++.dg/cpp1z/lambda-this2.C index 5a0066d750b..f3ef8e36313 100644 --- a/gcc/testsuite/g++.dg/cpp1z/lambda-this2.C +++ b/gcc/testsuite/g++.dg/cpp1z/lambda-this2.C @@ -12,7 +12,7 @@ struct A { if (z != 0) abort (); auto b = [this] { return &a; }; auto c = [*this] { return &a; }; // { dg-warning "'*this' capture only available with" "" { target c++14_down } } - auto d = [=] { return &a; }; + auto d = [=] { return &a; }; // { dg-warning "implicit capture" "" { target c++2a } } auto e = [&] { return &a; }; if (b () != &a) abort (); if (*b () != 4) abort (); @@ -24,7 +24,7 @@ struct A { if (e () != &a) abort (); auto g = [this] { return a + z; }; auto h = [*this] { return a + z; }; // { dg-warning "'*this' capture only available with" "" { target c++14_down } } - auto i = [=] { return a + z; }; + auto i = [=] { return a + z; }; // { dg-warning "implicit capture" "" { target c++2a } } auto j = [&] { return a + z; }; if (g () != 4 || h () != 5 || i () != 4 || j () != 4) abort (); } @@ -39,7 +39,7 @@ struct B { if (z != 0) abort (); auto b = [this] { return &a; }; auto c = [*this] { return &a; }; // { dg-warning "'*this' capture only available with" "" { target c++14_down } } - auto d = [=] { return &a; }; + auto d = [=] { return &a; }; // { dg-warning "implicit capture" "" { target c++2a } } auto e = [&] { return &a; }; if (b () != &a) abort (); if (*b () != 9) abort (); @@ -51,7 +51,7 @@ struct B { if (e () != &a) abort (); auto g = [this] { return a + z; }; auto h = [*this] { return a + z; }; // { dg-warning "'*this' capture only available with" "" { target c++14_down } } - auto i = [=] { return a + z; }; + auto i = [=] { return a + z; }; // { dg-warning "implicit capture" "" { target c++2a } } auto j = [&] { return a + z; }; if (g () != 9 || h () != 10 || i () != 9 || j () != 9) abort (); } diff --git a/gcc/testsuite/g++.dg/template/crash84.C b/gcc/testsuite/g++.dg/template/crash84.C index b3099d931c2..f90cf5c18d4 100644 --- a/gcc/testsuite/g++.dg/template/crash84.C +++ b/gcc/testsuite/g++.dg/template/crash84.C @@ -14,7 +14,7 @@ void foo () { a a1; // OK - a::b b1; // { dg-error "template argument|converted constant" } + a::b b1; // { dg-error "template argument|convert" } } // { dg-prune-output "invalid type in declaration" } -- 2.30.2