Commit e00dfa84 by Marek Polacek Committed by Marek Polacek

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
parent 208121b5
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> 2018-09-07 Marek Polacek <polacek@redhat.com>
* g++.dg/cpp1z/direct-enum-init1.C: Remove "inside" from diagnostic * g++.dg/cpp1z/direct-enum-init1.C: Remove "inside" from diagnostic
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-prune-output "sorry, unimplemented: non-trivial designated initializers not supported" } */ /* { 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 } } */ char x[] = { [-1] = 1, 2, 3 }; /* { dg-error "array index in initializer exceeds array bounds" "" { target c } } */
...@@ -5,5 +5,6 @@ struct S { ...@@ -5,5 +5,6 @@ struct S {
void f(); void f();
void g() const { void g() const {
[=] { f(); } (); // { dg-error "no match|qualifiers" } [=] { f(); } (); // { dg-error "no match|qualifiers" }
// { dg-warning "implicit capture" "" { target c++2a } .-1 }
} }
}; };
...@@ -18,8 +18,9 @@ class C { ...@@ -18,8 +18,9 @@ class C {
[&] () -> void { this->m_i = 3; } (); [&] () -> void { this->m_i = 3; } ();
assert(m_i == 3); assert(m_i == 3);
[=] () -> void { m_i = 4; } (); // copies 'this' or --copies-m_i--? [=] () -> void { m_i = 4; } (); // copies 'this' or --copies-m_i--?
// { dg-warning "implicit capture" "" { target c++2a } .-1 }
assert(m_i == 4); 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); assert(m_i == 5);
} }
......
...@@ -18,8 +18,9 @@ class C { ...@@ -18,8 +18,9 @@ class C {
[&] () -> void { this->m_i = 3; } (); [&] () -> void { this->m_i = 3; } ();
assert(m_i == 3); assert(m_i == 3);
[=] () -> void { m_i = 4; } (); // copies 'this' or --copies-m_i--? [=] () -> void { m_i = 4; } (); // copies 'this' or --copies-m_i--?
// { dg-warning "implicit capture" "" { target c++2a } .-1 }
assert(m_i == 4); 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); assert(m_i == 5);
} }
......
...@@ -7,7 +7,7 @@ struct A { ...@@ -7,7 +7,7 @@ struct A {
A(): i(42) { } A(): i(42) { }
int f() { int f() {
return [this]{ return [this]{
return [=]{ return i; }(); return [=]{ return i; }(); // { dg-warning "implicit capture" "" { target c++2a } }
}(); }();
} }
}; };
......
// PR c++/56464 // PR c++/56464
// { dg-do run { target c++11 } } // { 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() int main()
{ {
bug b; bug b;
......
...@@ -10,5 +10,5 @@ struct function ...@@ -10,5 +10,5 @@ struct function
struct testee struct testee
{ {
function l1 = []() { }; function l1 = []() { };
function l2 = [=]() { l1; }; function l2 = [=]() { l1; }; // { dg-warning "implicit capture" "" { target c++2a } }
}; };
...@@ -6,8 +6,9 @@ struct A ...@@ -6,8 +6,9 @@ struct A
int i; int i;
void f() void f()
{ {
[=] { i = 0; }; [=] { i = 0; }; // { dg-warning "implicit capture" "" { target c++2a } }
[&] { i = 0; }; [&] { i = 0; };
[=] { this = 0; }; // { dg-error "lvalue" } [=] { this = 0; }; // { dg-error "lvalue" }
// { dg-warning "implicit capture" "" { target c++2a } .-1 }
} }
}; };
...@@ -7,7 +7,7 @@ struct Test { ...@@ -7,7 +7,7 @@ struct Test {
struct TestPickled : Test { struct TestPickled : Test {
template<typename... Args> void triggerTest (Args&&... fargs) { template<typename... Args> void triggerTest (Args&&... fargs) {
[=](Args... as) { [=](Args... as) { // { dg-warning "implicit capture" "" { target c++2a } }
Test::triggerTest (as...); Test::triggerTest (as...);
} (); } ();
} }
......
...@@ -18,7 +18,7 @@ template <class U> ...@@ -18,7 +18,7 @@ template <class U>
void void
A<T>::bar () 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 (); f ();
} }
......
...@@ -7,7 +7,7 @@ struct S1 { ...@@ -7,7 +7,7 @@ struct S1 {
int i; int i;
void g(); void g();
void f() { void f() {
[=]() { [=]() { // { dg-warning "implicit capture" "" { target c++2a } }
i; i;
g(); g();
S1::g(); S1::g();
......
...@@ -6,21 +6,21 @@ ...@@ -6,21 +6,21 @@
struct test { struct test {
template<typename T> template<typename T>
std::function<void()> broken(int x) { 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() { std::function<void()> works0() {
return [=] { print<int>(); }; return [=] { print<int>(); }; // { dg-warning "implicit capture" "" { target c++2a } }
} }
template<typename T> template<typename T>
std::function<void()> works1() { std::function<void()> works1() {
return [=] { print<int>(); }; return [=] { print<int>(); }; // { dg-warning "implicit capture" "" { target c++2a } }
} }
template<typename T> template<typename T>
std::function<void()> works2() { std::function<void()> works2() {
return [=] { this->print<T>(); }; return [=] { this->print<T>(); }; // { dg-warning "implicit capture" "" { target c++2a } }
} }
template<typename T> template<typename T>
......
...@@ -9,7 +9,7 @@ struct my_queue ...@@ -9,7 +9,7 @@ struct my_queue
} }
void ice() void ice()
{ {
auto L = [=](auto &&v) { auto L = [=](auto &&v) { // { dg-warning "implicit capture" "" { target c++2a } }
push(v); push(v);
}; };
trav(L); trav(L);
......
...@@ -8,7 +8,7 @@ struct A { ...@@ -8,7 +8,7 @@ struct A {
struct B { struct B {
B(); B();
template <typename... Args> auto g(Args &&... p1) { 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 *); void f(A, const char *);
}; };
......
...@@ -15,7 +15,7 @@ struct A { ...@@ -15,7 +15,7 @@ struct A {
auto g = [*this] { a++; }; // { dg-error "in read-only object" } auto g = [*this] { a++; }; // { dg-error "in read-only object" }
// { dg-error "'*this' capture only available with" "" { target c++14_down } .-1 } // { 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 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; }; auto j = [&] { return a; };
// P0409R2 - C++2A lambda capture [=, this] // 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 } } 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 { ...@@ -62,7 +62,7 @@ struct C {
auto d = [this] { return c; }; auto d = [this] { return c; };
auto e = [*this] { return c; }; // { dg-error "use of deleted function" } auto e = [*this] { return c; }; // { dg-error "use of deleted function" }
// { dg-error "'*this' capture only available with" "" { target c++14_down } .-1 } // { 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 g = [&] { return c; };
auto h = [this] { bar (); }; auto h = [this] { bar (); };
auto i = [*this] { bar (); }; // { dg-error "use of deleted function" } auto i = [*this] { bar (); }; // { dg-error "use of deleted function" }
...@@ -77,7 +77,7 @@ struct D { ...@@ -77,7 +77,7 @@ struct D {
auto e = [this] { return d; }; auto e = [this] { return d; };
auto f = [*this] { return d; }; // { dg-error "use of deleted function" } auto f = [*this] { return d; }; // { dg-error "use of deleted function" }
// { dg-error "'*this' capture only available with" "" { target c++14_down } .-1 } // { 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 h = [&] { return d; };
auto i = [this] { bar (); }; auto i = [this] { bar (); };
auto j = [*this] { bar (); }; // { dg-error "use of deleted function" } auto j = [*this] { bar (); }; // { dg-error "use of deleted function" }
......
...@@ -12,7 +12,7 @@ struct A { ...@@ -12,7 +12,7 @@ struct A {
if (z != 0) abort (); if (z != 0) abort ();
auto b = [this] { return &a; }; auto b = [this] { return &a; };
auto c = [*this] { return &a; }; // { dg-warning "'*this' capture only available with" "" { target c++14_down } } 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; }; auto e = [&] { return &a; };
if (b () != &a) abort (); if (b () != &a) abort ();
if (*b () != 4) abort (); if (*b () != 4) abort ();
...@@ -24,7 +24,7 @@ struct A { ...@@ -24,7 +24,7 @@ struct A {
if (e () != &a) abort (); if (e () != &a) abort ();
auto g = [this] { return a + z; }; auto g = [this] { return a + z; };
auto h = [*this] { return a + z; }; // { dg-warning "'*this' capture only available with" "" { target c++14_down } } 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; }; auto j = [&] { return a + z; };
if (g () != 4 || h () != 5 || i () != 4 || j () != 4) abort (); if (g () != 4 || h () != 5 || i () != 4 || j () != 4) abort ();
} }
...@@ -39,7 +39,7 @@ struct B { ...@@ -39,7 +39,7 @@ struct B {
if (z != 0) abort (); if (z != 0) abort ();
auto b = [this] { return &a; }; auto b = [this] { return &a; };
auto c = [*this] { return &a; }; // { dg-warning "'*this' capture only available with" "" { target c++14_down } } 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; }; auto e = [&] { return &a; };
if (b () != &a) abort (); if (b () != &a) abort ();
if (*b () != 9) abort (); if (*b () != 9) abort ();
...@@ -51,7 +51,7 @@ struct B { ...@@ -51,7 +51,7 @@ struct B {
if (e () != &a) abort (); if (e () != &a) abort ();
auto g = [this] { return a + z; }; auto g = [this] { return a + z; };
auto h = [*this] { return a + z; }; // { dg-warning "'*this' capture only available with" "" { target c++14_down } } 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; }; auto j = [&] { return a + z; };
if (g () != 9 || h () != 10 || i () != 9 || j () != 9) abort (); if (g () != 9 || h () != 10 || i () != 9 || j () != 9) abort ();
} }
......
...@@ -14,7 +14,7 @@ void ...@@ -14,7 +14,7 @@ void
foo () foo ()
{ {
a<int> a1; // OK 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" } // { dg-prune-output "invalid type in declaration" }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment