* 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
+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
/* { 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 } } */
void f();
void g() const {
[=] { f(); } (); // { dg-error "no match|qualifiers" }
+// { dg-warning "implicit capture" "" { target c++2a } .-1 }
}
};
[&] () -> 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);
}
[&] () -> 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);
}
A(): i(42) { }
int f() {
return [this]{
- return [=]{ return i; }();
+ return [=]{ return i; }(); // { dg-warning "implicit capture" "" { target c++2a } }
}();
}
};
// 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;
struct testee
{
function l1 = []() { };
- function l2 = [=]() { l1; };
+ function l2 = [=]() { l1; }; // { dg-warning "implicit capture" "" { target c++2a } }
};
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 }
}
};
struct TestPickled : Test {
template<typename... Args> void triggerTest (Args&&... fargs) {
- [=](Args... as) {
+ [=](Args... as) { // { dg-warning "implicit capture" "" { target c++2a } }
Test::triggerTest (as...);
} ();
}
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 ();
}
int i;
void g();
void f() {
- [=]() {
+ [=]() { // { dg-warning "implicit capture" "" { target c++2a } }
i;
g();
S1::g();
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>
}
void ice()
{
- auto L = [=](auto &&v) {
+ auto L = [=](auto &&v) { // { dg-warning "implicit capture" "" { target c++2a } }
push(v);
};
trav(L);
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 *);
};
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 } }
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" }
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" }
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 ();
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 ();
}
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 ();
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 ();
}
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" }