Commit 1d500c25 by Jason Merrill Committed by Jason Merrill

Pedwarn about auto parameter even without -Wpedantic.

	* parser.c (cp_parser_simple_type_specifier): Pedwarn about auto
	parameter even without -Wpedantic.

From-SVN: r258494
parent 426c1e2e
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.
......
......@@ -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 ();
// 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; }
......
// 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();
......
// 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);
......
// PR c++/58500
// { dg-do compile { target c++14 } }
// { dg-options "" }
// { dg-additional-options "-fconcepts" }
struct A {};
......
// PR c++/58534
// { dg-do compile { target c++14 } }
// { dg-options "" }
// { dg-additional-options "-fconcepts" }
template<typename> void foo(const auto&) {}
......
// PR c++/58535
// { dg-do compile { target c++14 } }
// { dg-options "" }
struct A
{
virtual void foo(auto); // { dg-error "templates" }
virtual void foo(auto); // { dg-error "auto|templates" }
};
// PR c++/58536
// { dg-do compile { target c++14 } }
// { dg-options "" }
// { dg-additional-options "-fconcepts" }
struct A
{
......
// PR c++/58548
// { dg-do compile { target c++14 } }
// { dg-options "" }
// { dg-additional-options "-fconcepts" }
void foo(auto)
{
......
// PR c++/58549
// { dg-do compile { target c++14 } }
// { dg-options "" }
// { dg-additional-options "-fconcepts" }
void foo(auto)
{
......
// PR c++/60052
// { dg-do compile { target c++14 } }
// { dg-options "" }
// { dg-additional-options "-fconcepts" }
struct A
{
......
// PR c++/60053
// { dg-do compile { target c++14 } }
// { dg-options "" }
// { dg-additional-options "-fconcepts" }
struct A
{
......
// PR c++/60064
// { dg-do compile { target c++14 } }
// { dg-options "" }
// { dg-additional-options "-fconcepts" }
class A
{
......
// 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);
......
// 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
{
......
// PR c++/60390
// { dg-do compile { target c++14 } }
// { dg-options "" }
// { dg-additional-options "-fconcepts" }
struct A
{
......
// 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 {}
// PR c++/60573
// { dg-do compile { target c++14 } }
// { dg-options "" }
// { dg-additional-options "-fconcepts" }
struct A
{
......
// PR c++/80471
// { dg-do compile { target c++14 } }
// { dg-options "" }
// { dg-additional-options "-fconcepts" }
template <class, class>
constexpr bool is_same = false;
......
// PR c++/60626
// { dg-do compile { target c++14 } }
// { dg-options "" }
struct A {};
void (*A::p)(auto) = 0; // { dg-error "static data member|template" }
void (*A::p)(auto) = 0; // { dg-error "auto|static data member|template" }
// 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" }
......@@ -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];
......
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