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
This commit is contained in:
Marek Polacek 2018-09-08 14:27:25 +00:00 committed by Marek Polacek
parent 208121b583
commit e00dfa841f
18 changed files with 48 additions and 23 deletions

View File

@ -1,3 +1,23 @@
2018-09-08 Marek Polacek <polacek@redhat.com>
* 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 <polacek@redhat.com>
* g++.dg/cpp1z/direct-enum-init1.C: Remove "inside" from diagnostic

View File

@ -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 } } */

View File

@ -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 }
}
};

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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 } }
}();
}
};

View File

@ -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;

View File

@ -10,5 +10,5 @@ struct function
struct testee
{
function l1 = []() { };
function l2 = [=]() { l1; };
function l2 = [=]() { l1; }; // { dg-warning "implicit capture" "" { target c++2a } }
};

View File

@ -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 }
}
};

View File

@ -7,7 +7,7 @@ struct Test {
struct TestPickled : Test {
template<typename... Args> void triggerTest (Args&&... fargs) {
[=](Args... as) {
[=](Args... as) { // { dg-warning "implicit capture" "" { target c++2a } }
Test::triggerTest (as...);
} ();
}

View File

@ -18,7 +18,7 @@ template <class U>
void
A<T>::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 ();
}

View File

@ -7,7 +7,7 @@ struct S1 {
int i;
void g();
void f() {
[=]() {
[=]() { // { dg-warning "implicit capture" "" { target c++2a } }
i;
g();
S1::g();

View File

@ -6,21 +6,21 @@
struct test {
template<typename T>
std::function<void()> broken(int x) {
return [=] { +x; print<T>(); };
return [=] { +x; print<T>(); }; // { dg-warning "implicit capture" "" { target c++2a } }
}
std::function<void()> works0() {
return [=] { print<int>(); };
return [=] { print<int>(); }; // { dg-warning "implicit capture" "" { target c++2a } }
}
template<typename T>
std::function<void()> works1() {
return [=] { print<int>(); };
return [=] { print<int>(); }; // { dg-warning "implicit capture" "" { target c++2a } }
}
template<typename T>
std::function<void()> works2() {
return [=] { this->print<T>(); };
return [=] { this->print<T>(); }; // { dg-warning "implicit capture" "" { target c++2a } }
}
template<typename T>

View File

@ -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);

View File

@ -8,7 +8,7 @@ struct A {
struct B {
B();
template <typename... Args> auto g(Args &&... p1) {
return [=] { f(p1...); };
return [=] { f(p1...); }; // { dg-warning "implicit capture" "" { target c++2a } }
}
void f(A, const char *);
};

View File

@ -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" }

View File

@ -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 ();
}

View File

@ -14,7 +14,7 @@ void
foo ()
{
a<int> a1; // OK
a<int>::b<a,int> b1; // { dg-error "template argument|converted constant" }
a<int>::b<a,int> b1; // { dg-error "template argument|convert" }
}
// { dg-prune-output "invalid type in declaration" }