+2017-01-25 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/77914
+ * parser.c (cp_parser_lambda_declarator_opt): Pedwarn with
+ OPT_Wpedantic on lambda templates for -std=c++14 and higher.
+
2017-01-25 Maxim Ostapenko <m.ostapenko@samsung.com>
PR lto/79061
pedwarn (parser->lexer->next_token->location, 0,
"lambda templates are only available with "
"-std=c++14 or -std=gnu++14");
+ else
+ pedwarn (parser->lexer->next_token->location, OPT_Wpedantic,
+ "ISO C++ does not support lambda templates");
cp_lexer_consume_token (parser->lexer);
+2017-01-25 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/77914
+ * g++.dg/cpp1y/lambda-generic-77914.C: New test.
+ * g++.dg/cpp1y/lambda-generic-dep.C: Add -pedantic to dg-options,
+ expect a warning.
+ * g++.dg/cpp1y/lambda-generic-x.C: Add -Wpedantic to dg-options,
+ expect warnings.
+ * g++.dg/cpp1y/lambda-generic-mixed.C: Add empty dg-options.
+ * g++.dg/cpp1y/pr59636.C: Likewise.
+ * g++.dg/cpp1y/pr60190.C: Likewise.
+
2017-01-25 Bin Cheng <bin.cheng@arm.com>
* gcc.dg/vect/vect-24.c: Remove xfail on ARM targets.
--- /dev/null
+// PR c++/77914
+// { dg-do compile { target c++14 } }
+
+int
+main ()
+{
+ auto l = [] <typename T> () {}; // { dg-error "does not support lambda templates" }
+ l.operator () <void> ();
+}
// Generic lambda type dependence test part from N3690 5.1.2.12
// { dg-do compile { target c++14 } }
+// { dg-options "-pedantic" }
void f(int, const int (&)[2] = {}) { } // #1
void f(const int&, const int (&)[1]) { } // #2
int main()
{
- auto f = [] <typename T> (T const& s) mutable {
+ auto f = [] <typename T> (T const& s) mutable { // { dg-warning "does not support lambda templates" }
typename T::N x;
return x.test ();
};
// Mixed explicit and implicit generic lambda test.
// { dg-do compile { target c++14 } }
+// { dg-options "" }
int main()
{
// Explicit generic lambda test from N3690 5.1.2.5
// { dg-do compile { target c++14 } }
+// { dg-options "-Wpedantic" }
#include <iostream>
int main()
{
- auto glambda = [] <typename A, typename B> (A a, B&& b) { return a < b; };
+ auto glambda = [] <typename A, typename B> (A a, B&& b) { return a < b; }; // { dg-warning "does not support lambda templates" }
bool b = glambda(3, 3.14); // OK
- auto vglambda = [] <typename P> (P printer) {
+ auto vglambda = [] <typename P> (P printer) { // { dg-warning "does not support lambda templates" }
return [=] <typename... T> (T&& ... ts) { // OK: ts is a function parameter pack
- printer(std::forward<decltype(ts)>(ts)...);
+ printer(std::forward<decltype(ts)>(ts)...); // { dg-warning "does not support lambda templates" "" { target *-*-* } .-1 }
return [=]() {
printer(ts ...);
};
};
};
- auto p = vglambda( [] <typename A,
+ auto p = vglambda( [] <typename A, // { dg-warning "does not support lambda templates" }
typename B,
typename C> (A v1, B v2, C v3)
{ std::cout << v1 << v2 << v3; } );
// PR c++/59636
// { dg-do compile { target c++14 } }
+// { dg-options "" }
auto f = []() { return []<>() {}; }; // { dg-error "expected identifier" }
// PR c++/60190
// { dg-do compile { target c++14 } }
+// { dg-options "" }
auto f = []<int>() -> int() {}; // { dg-error "returning a function|expected" }