aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl.c
diff options
context:
space:
mode:
authorPatrick Palka <ppalka@gcc.gnu.org>2016-01-19 00:19:16 +0000
committerPatrick Palka <ppalka@gcc.gnu.org>2016-01-19 00:19:16 +0000
commit17c15cb932563bb814865c39abc2b952c7707f79 (patch)
treec8fda91b6b8fbccdc143d90c1d753def47ac5deb /gcc/cp/decl.c
parent49f8a19186f939a7561cb2bae31ffa67c649c606 (diff)
downloadgcc-17c15cb932563bb814865c39abc2b952c7707f79.zip
gcc-17c15cb932563bb814865c39abc2b952c7707f79.tar.gz
gcc-17c15cb932563bb814865c39abc2b952c7707f79.tar.bz2
Fix the remaining PR c++/24666 blockers (arrays decay to pointers too early)
gcc/cp/ChangeLog: PR c++/11858 PR c++/24663 PR c++/24664 * decl.c (grokdeclarator): Don't decay array parameter type to a pointer type if it's dependent. (grokparms): Invoke strip_top_quals instead of directly invoking cp_build_qualified_type. * pt.c (decay_dependent_array_parm_type): New static function. (type_unification_real): Call decay_dependent_array_parm_type to decay a dependent array parameter type to its corresponding pointer type before unification. (more_specialized_fn): Likewise. (get_bindings): Likewise. * tree.c (cp_build_qualified_type): Trivial typofix in documentation. gcc/testsuite/ChangeLog: PR c++/11858 PR c++/24663 PR c++/24664 * g++.dg/template/pr11858.C: New test. * g++.dg/template/pr24663.C: New test. * g++.dg/template/unify12.C: New test. * g++.dg/template/unify13.C: New test. * g++.dg/template/unify14.C: New test. * g++.dg/template/unify15.C: New test. * g++.dg/template/unify16.C: New test. * g++.dg/template/unify17.C: New test. From-SVN: r232547
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r--gcc/cp/decl.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index df95133..187390d 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -10898,8 +10898,13 @@ grokdeclarator (const cp_declarator *declarator,
if (TREE_CODE (type) == ARRAY_TYPE)
{
- /* Transfer const-ness of array into that of type pointed to. */
- type = build_pointer_type (TREE_TYPE (type));
+ /* Withhold decaying a dependent array type so that that during
+ instantiation we can detect type deduction failure cases such as
+ creating an array of void, creating a zero-size array, etc. */
+ if (dependent_type_p (type))
+ ;
+ else
+ type = build_pointer_type (TREE_TYPE (type));
type_quals = TYPE_UNQUALIFIED;
array_parameter_p = true;
}
@@ -11696,7 +11701,8 @@ grokparms (tree parmlist, tree *parms)
/* Top-level qualifiers on the parameters are
ignored for function types. */
- type = cp_build_qualified_type (type, 0);
+ type = strip_top_quals (type);
+
if (TREE_CODE (type) == METHOD_TYPE)
{
error ("parameter %qD invalidly declared method type", decl);