]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Pedwarn about auto parameter even without -Wpedantic.
authorJason Merrill <jason@redhat.com>
Tue, 13 Mar 2018 15:55:44 +0000 (11:55 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 13 Mar 2018 15:55:44 +0000 (11:55 -0400)
* parser.c (cp_parser_simple_type_specifier): Pedwarn about auto
parameter even without -Wpedantic.

From-SVN: r258494

25 files changed:
gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/g++.dg/concepts/abbrev1.C [moved from gcc/testsuite/g++.dg/cpp1z/abbrev1.C with 70% similarity]
gcc/testsuite/g++.dg/concepts/abbrev2.C [moved from gcc/testsuite/g++.dg/cpp1z/abbrev2.C with 79% similarity]
gcc/testsuite/g++.dg/concepts/fn-generic-member-ool.C [moved from gcc/testsuite/g++.dg/cpp1y/fn-generic-member-ool.C with 93% similarity]
gcc/testsuite/g++.dg/concepts/pr58500.C [moved from gcc/testsuite/g++.dg/cpp1y/pr58500.C with 69% similarity]
gcc/testsuite/g++.dg/concepts/pr58534.C [moved from gcc/testsuite/g++.dg/cpp1y/pr58534.C with 79% similarity]
gcc/testsuite/g++.dg/concepts/pr58535.C [new file with mode: 0644]
gcc/testsuite/g++.dg/concepts/pr58536.C [moved from gcc/testsuite/g++.dg/cpp1y/pr58536.C with 69% similarity]
gcc/testsuite/g++.dg/concepts/pr58548.C [moved from gcc/testsuite/g++.dg/cpp1y/pr58548.C with 69% similarity]
gcc/testsuite/g++.dg/concepts/pr58549.C [moved from gcc/testsuite/g++.dg/cpp1y/pr58549.C with 67% similarity]
gcc/testsuite/g++.dg/concepts/pr60052.C [moved from gcc/testsuite/g++.dg/cpp1y/pr60052.C with 77% similarity]
gcc/testsuite/g++.dg/concepts/pr60053.C [moved from gcc/testsuite/g++.dg/cpp1y/pr60053.C with 81% similarity]
gcc/testsuite/g++.dg/concepts/pr60064.C [moved from gcc/testsuite/g++.dg/cpp1y/pr60064.C with 82% similarity]
gcc/testsuite/g++.dg/concepts/pr60065.C [moved from gcc/testsuite/g++.dg/cpp1y/pr60065.C with 85% similarity]
gcc/testsuite/g++.dg/concepts/pr60377.C [moved from gcc/testsuite/g++.dg/cpp1y/pr60377.C with 50% similarity]
gcc/testsuite/g++.dg/concepts/pr60390.C [moved from gcc/testsuite/g++.dg/cpp1y/pr60390.C with 84% similarity]
gcc/testsuite/g++.dg/concepts/pr60391.C [moved from gcc/testsuite/g++.dg/cpp1y/pr60391.C with 53% similarity]
gcc/testsuite/g++.dg/concepts/pr60573.C [moved from gcc/testsuite/g++.dg/cpp1y/pr60573.C with 90% similarity]
gcc/testsuite/g++.dg/concepts/pr80471.C [moved from gcc/testsuite/g++.dg/cpp1y/pr80471.C with 92% similarity]
gcc/testsuite/g++.dg/cpp0x/auto-60626.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp0x/auto-84662.C [moved from gcc/testsuite/g++.dg/cpp1y/pr84662.C with 57% similarity]
gcc/testsuite/g++.dg/cpp1y/pr58535.C [deleted file]
gcc/testsuite/g++.dg/cpp1y/pr60626.C [deleted file]
gcc/testsuite/g++.dg/cpp1z/decomp3.C

index d480c1bafba0c9de77bac149d6108d9836cf1a7a..0da60a3e99bf9a09110bdfb66b2e678cb1e38ea4 100644 (file)
@@ -1,5 +1,8 @@
 2018-03-13  Jason Merrill  <jason@redhat.com>
 
+       * parser.c (cp_parser_simple_type_specifier): Pedwarn about auto
+       parameter even without -Wpedantic.
+
        PR c++/84798 - ICE with auto in abstract function declarator.
        * parser.c (cp_parser_parameter_declaration_clause): Check
        parser->default_arg_ok_p.
index 8e8ebceb0d584cd65996c87011fc1b2720744258..0a82f415196c3b77b7984540a9e6d44ee6e2d8c3 100644 (file)
@@ -17049,9 +17049,9 @@ cp_parser_simple_type_specifier (cp_parser* parser,
                     "only available with "
                     "-std=c++14 or -std=gnu++14");
          else if (!flag_concepts)
-           pedwarn (token->location, OPT_Wpedantic,
-                    "ISO C++ forbids use of %<auto%> in parameter "
-                    "declaration");
+           pedwarn (token->location, 0,
+                    "use of %<auto%> in parameter declaration "
+                    "only available with -fconcepts");
        }
       else
        type = make_auto ();
similarity index 70%
rename from gcc/testsuite/g++.dg/cpp1z/abbrev1.C
rename to gcc/testsuite/g++.dg/concepts/abbrev1.C
index 3caa814c58dc675899e002ea1d7ed3878afc8a48..8de681f2db6a412d111549dbfab0ab00cbe0ce2a 100644 (file)
@@ -1,5 +1,6 @@
 // PR c++/64969
-// { dg-options "-std=c++17" }
+// { dg-do compile { target c++14 } }
+// { dg-additional-options "-fconcepts" }
 
 auto f1(auto x) { return *x; }
 decltype(auto) f2(auto x) { return *x; }
similarity index 79%
rename from gcc/testsuite/g++.dg/cpp1z/abbrev2.C
rename to gcc/testsuite/g++.dg/concepts/abbrev2.C
index 1dc6af3a57d6de86ee5b2f899045239f4b1e513a..3100f67254ebcb9603d2abfb882a10769ec1cc1d 100644 (file)
@@ -1,6 +1,6 @@
 // PR c++/66197
-// { dg-do run }
-// { dg-options "-std=c++17" }
+// { dg-do run { target c++14 } }
+// { dg-additional-options "-fconcepts" }
 
 extern "C" void abort();
 
similarity index 93%
rename from gcc/testsuite/g++.dg/cpp1y/fn-generic-member-ool.C
rename to gcc/testsuite/g++.dg/concepts/fn-generic-member-ool.C
index 60ac52eff5bba671a3285ac8adf6b543e33c6edf..b664ccf3da1f8154c78e2903ff66f0f995f8fa27 100644 (file)
@@ -1,6 +1,6 @@
 // Out-of-line generic member function definitions.
 // { dg-do compile { target c++14 } }
-// { dg-options "" }
+// { dg-additional-options "-fconcepts" }
 
 struct A {
   void f(auto x);
similarity index 69%
rename from gcc/testsuite/g++.dg/cpp1y/pr58500.C
rename to gcc/testsuite/g++.dg/concepts/pr58500.C
index bb68cbc1999d85618bf9acb7aa2c80bbdd657493..cb74072a570d4435e0c27431ce692a48e4471a02 100644 (file)
@@ -1,6 +1,6 @@
 // PR c++/58500
 // { dg-do compile { target c++14 } }
-// { dg-options "" }
+// { dg-additional-options "-fconcepts" }
 
 struct A {};
 
similarity index 79%
rename from gcc/testsuite/g++.dg/cpp1y/pr58534.C
rename to gcc/testsuite/g++.dg/concepts/pr58534.C
index e38e1f3f66795cf6e24a7a42e7d750c7538ab23b..b2c3caac63c9c9923192a5546e828bcc4b91a52e 100644 (file)
@@ -1,6 +1,6 @@
 // PR c++/58534
 // { dg-do compile { target c++14 } }
-// { dg-options "" }
+// { dg-additional-options "-fconcepts" }
 
 template<typename> void foo(const auto&) {}
 
diff --git a/gcc/testsuite/g++.dg/concepts/pr58535.C b/gcc/testsuite/g++.dg/concepts/pr58535.C
new file mode 100644 (file)
index 0000000..3e212a0
--- /dev/null
@@ -0,0 +1,7 @@
+// PR c++/58535
+// { dg-do compile { target c++14 } }
+
+struct A
+{
+  virtual void foo(auto); // { dg-error "auto|templates" }
+};
similarity index 69%
rename from gcc/testsuite/g++.dg/cpp1y/pr58536.C
rename to gcc/testsuite/g++.dg/concepts/pr58536.C
index a4b6f553efdfe53180ec70bb9b9e4fe2b1c7cf4c..99c7ebee309faca949ce204f532e0e2ff5f805dd 100644 (file)
@@ -1,6 +1,6 @@
 // PR c++/58536
 // { dg-do compile { target c++14 } }
-// { dg-options "" }
+// { dg-additional-options "-fconcepts" }
 
 struct A
 {
similarity index 69%
rename from gcc/testsuite/g++.dg/cpp1y/pr58548.C
rename to gcc/testsuite/g++.dg/concepts/pr58548.C
index 6a78de46c3f11e605e034d3c4443dbcb2a786db8..cd3e6fdb2dcc4ee48f5ce56976ba4f3d3a47e686 100644 (file)
@@ -1,6 +1,6 @@
 // PR c++/58548
 // { dg-do compile { target c++14 } }
-// { dg-options "" }
+// { dg-additional-options "-fconcepts" }
 
 void foo(auto)
 {
similarity index 67%
rename from gcc/testsuite/g++.dg/cpp1y/pr58549.C
rename to gcc/testsuite/g++.dg/concepts/pr58549.C
index 2f76399d8dd22787ac7c270fc89962bf0a007321..6b66afc1ad2b8c33bcba772251abe4dce715df87 100644 (file)
@@ -1,6 +1,6 @@
 // PR c++/58549
 // { dg-do compile { target c++14 } }
-// { dg-options "" }
+// { dg-additional-options "-fconcepts" }
 
 void foo(auto)
 {
similarity index 77%
rename from gcc/testsuite/g++.dg/cpp1y/pr60052.C
rename to gcc/testsuite/g++.dg/concepts/pr60052.C
index 25d20acdf84a1159b19bbf98ec033cdaa4036b22..c5bc28efd07f1b7ba5524a30c965c3fbde5efebe 100644 (file)
@@ -1,6 +1,6 @@
 // PR c++/60052
 // { dg-do compile { target c++14 } }
-// { dg-options "" }
+// { dg-additional-options "-fconcepts" }
 
 struct A
 {
similarity index 81%
rename from gcc/testsuite/g++.dg/cpp1y/pr60053.C
rename to gcc/testsuite/g++.dg/concepts/pr60053.C
index a8f5ba1ca3f4007ce7227ab3c9846f7c31820687..20cf1216b0ee813447e841d4b979ca03d19ec499 100644 (file)
@@ -1,6 +1,6 @@
 // PR c++/60053
 // { dg-do compile { target c++14 } }
-// { dg-options "" }
+// { dg-additional-options "-fconcepts" }
 
 struct A
 {
similarity index 82%
rename from gcc/testsuite/g++.dg/cpp1y/pr60064.C
rename to gcc/testsuite/g++.dg/concepts/pr60064.C
index add3f05cbbd6d9a8c8c5bd8b21008e542c9ca9dc..b82b560d1f5801af41dc5ebc454663ebbd12238c 100644 (file)
@@ -1,6 +1,6 @@
 // PR c++/60064
 // { dg-do compile { target c++14 } }
-// { dg-options "" }
+// { dg-additional-options "-fconcepts" }
 
 class A
 {
similarity index 85%
rename from gcc/testsuite/g++.dg/cpp1y/pr60065.C
rename to gcc/testsuite/g++.dg/concepts/pr60065.C
index 56505b7bc04068b1aac3c4d4c35fefc9ed44f516..b2b1aea433e1d67305ca9157ac4b5a4755b49108 100644 (file)
@@ -1,6 +1,6 @@
 // PR c++/60065
 // { dg-do compile { target c++14 } }
-// { dg-options "" }
+// { dg-additional-options "-fconcepts" }
 
 template <int> void foo(auto... x);
 template <typename> void foo2(auto... x);
similarity index 50%
rename from gcc/testsuite/g++.dg/cpp1y/pr60377.C
rename to gcc/testsuite/g++.dg/concepts/pr60377.C
index ab35ba9b1729f319ec8ac7f03b25dc5cdeb65bd6..5b1871735c8066910392545911113b95fb71d951 100644 (file)
@@ -1,8 +1,7 @@
 // PR c++/60377
 // { dg-do compile { target c++14 } }
-// { dg-options "" }
 
-void foo(auto, void (f*)()); // { dg-error "expected" }
+void foo(auto, void (f*)()); // { dg-error "auto|expected" }
 
 struct A
 {
similarity index 84%
rename from gcc/testsuite/g++.dg/cpp1y/pr60390.C
rename to gcc/testsuite/g++.dg/concepts/pr60390.C
index 38d0e4bd6cd333b7c57a14697fbcbe1e8058b357..a453d1d61a3911d3d15389b44788df29ab1dcc71 100644 (file)
@@ -1,6 +1,6 @@
 // PR c++/60390
 // { dg-do compile { target c++14 } }
-// { dg-options "" }
+// { dg-additional-options "-fconcepts" }
 
 struct A
 {
similarity index 53%
rename from gcc/testsuite/g++.dg/cpp1y/pr60391.C
rename to gcc/testsuite/g++.dg/concepts/pr60391.C
index 7e3570498bcd650792224240b4d9795afd19bdc1..5c5ca2c2381ab5d4eed68a57181b7e43a8576287 100644 (file)
@@ -1,10 +1,9 @@
 // PR c++/60391
 // { dg-do compile { target c++14 } }
-// { dg-options "" }
 
 namespace N
 {
-  int operator"" _X(auto) {} // { dg-error "invalid" }
+  int operator"" _X(auto) {} // { dg-error "auto|invalid" }
 }
 
 namespace N {}
similarity index 90%
rename from gcc/testsuite/g++.dg/cpp1y/pr60573.C
rename to gcc/testsuite/g++.dg/concepts/pr60573.C
index da730f80f06002f3f8eecec8171f31fb13fcbc1f..568849175c69028e3dff4c5553957151286f0091 100644 (file)
@@ -1,6 +1,6 @@
 // PR c++/60573
 // { dg-do compile { target c++14 } }
-// { dg-options "" }
+// { dg-additional-options "-fconcepts" }
 
 struct A
 {
similarity index 92%
rename from gcc/testsuite/g++.dg/cpp1y/pr80471.C
rename to gcc/testsuite/g++.dg/concepts/pr80471.C
index bca4022cf57dde6b2dc014f2223459d50b67a737..d5fa5a536d3ff5278a910b584d2463fea813e024 100644 (file)
@@ -1,6 +1,6 @@
 // PR c++/80471
 // { dg-do compile { target c++14 } }
-// { dg-options "" }
+// { dg-additional-options "-fconcepts" }
 
 template <class, class>
 constexpr bool is_same = false;
diff --git a/gcc/testsuite/g++.dg/cpp0x/auto-60626.C b/gcc/testsuite/g++.dg/cpp0x/auto-60626.C
new file mode 100644 (file)
index 0000000..3567192
--- /dev/null
@@ -0,0 +1,6 @@
+// PR c++/60626
+// { dg-do compile { target c++14 } }
+
+struct A {};
+
+void (*A::p)(auto) = 0;  // { dg-error "auto|static data member|template" }
similarity index 57%
rename from gcc/testsuite/g++.dg/cpp1y/pr84662.C
rename to gcc/testsuite/g++.dg/cpp0x/auto-84662.C
index 36bd201073e5d7e80b558b0ab1793158e32c0fd0..271fb56f7eb2e037b52bb17875dbf31c6122e300 100644 (file)
@@ -1,6 +1,5 @@
 // PR c++/84662
 // { dg-do compile { target c++14 } }
-// { dg-options "" }
 
 double b;
-a (__attribute__((c (0 && int() - ([] {} && b) || auto))));    // { dg-error "expected constructor, destructor, or type conversion before" }
+a (__attribute__((c (0 && int() - ([] {} && b) || auto))));    // { dg-error "auto|expected constructor, destructor, or type conversion before" }
diff --git a/gcc/testsuite/g++.dg/cpp1y/pr58535.C b/gcc/testsuite/g++.dg/cpp1y/pr58535.C
deleted file mode 100644 (file)
index b36be8f..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-// PR c++/58535
-// { dg-do compile { target c++14 } }
-// { dg-options "" }
-
-struct A
-{
-  virtual void foo(auto); // { dg-error "templates" }
-};
diff --git a/gcc/testsuite/g++.dg/cpp1y/pr60626.C b/gcc/testsuite/g++.dg/cpp1y/pr60626.C
deleted file mode 100644 (file)
index 3114644..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-// PR c++/60626
-// { dg-do compile { target c++14 } }
-// { dg-options "" }
-
-struct A {};
-
-void (*A::p)(auto) = 0;  // { dg-error "static data member|template" }
index 529f3732fd5db7c77cd764919a4041c6bf417f8d..1886cdbe90d6295acdb0940c6bc764d4d70b9f23 100644 (file)
@@ -43,7 +43,7 @@ test (A &b, B c)
 
 void
 test2 (auto & [ p ] = bar ())          // { dg-error "'p' was not declared in this scope" }
-{
+{                                      // { dg-warning "auto" "" { target { ! concepts } } .-1 }
 }
 
 int arr[4];