Commit 19cf5a70 by Jason Merrill Committed by Jason Merrill

Core DR 393 - parameter pointer to array of unknown bound

	* decl.c (grokparms): Downgrade error about array of unknown bound
	to pedwarn and disable it for C++17.

From-SVN: r250137
parent f281956e
2017-07-11 Jason Merrill <jason@redhat.com>
Core DR 393
* decl.c (grokparms): Downgrade error about array of unknown bound
to pedwarn and disable it for C++17.
2017-07-11 Nathan Sidwell <nathan@acm.org>
* decl2.c (reset_type_linkage_2): Dont't change ctor name.
......
......@@ -12591,9 +12591,11 @@ grokparms (tree parmlist, tree *parms)
}
else if (abstract_virtuals_error (decl, type))
any_error = 1; /* Seems like a good idea. */
else if (POINTER_TYPE_P (type))
else if (cxx_dialect < cxx1z
&& POINTER_TYPE_P (type))
{
/* [dcl.fct]/6, parameter types cannot contain pointers
/* Before C++17 DR 393:
[dcl.fct]/6, parameter types cannot contain pointers
(references) to arrays of unknown bound. */
tree t = TREE_TYPE (type);
int ptr = TYPE_PTR_P (type);
......@@ -12609,12 +12611,13 @@ grokparms (tree parmlist, tree *parms)
t = TREE_TYPE (t);
}
if (TREE_CODE (t) == ARRAY_TYPE)
error (ptr
? G_("parameter %qD includes pointer to array of "
"unknown bound %qT")
: G_("parameter %qD includes reference to array of "
"unknown bound %qT"),
decl, t);
pedwarn (DECL_SOURCE_LOCATION (decl), OPT_Wpedantic,
ptr
? G_("parameter %qD includes pointer to array of "
"unknown bound %qT")
: G_("parameter %qD includes reference to array of "
"unknown bound %qT"),
decl, t);
}
if (any_error)
......
// DR 393
// { dg-options -Wpedantic }
void f(int (&)[]); // { dg-warning "unknown bound" "" { target c++14_down } }
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