From 9ece9d6eee56aeead6a0a1cc9b26e5f9bc2a377d Mon Sep 17 00:00:00 2001 From: paolo Date: Mon, 25 Nov 2013 09:29:18 +0000 Subject: [PATCH] /cp 2013-11-25 Paolo Carlini PR c++/59080 * pt.c (unify): Don't call unify_array_domain with a NULL_TREE third argument. PR c++/59096 * pt.c (apply_late_template_attributes): Check that TREE_VALUE isn't NULL_TREE in the attribute_takes_identifier_p case. /testsuite 2013-11-25 Paolo Carlini PR c++/59080 * g++.dg/cpp0x/initlist75.C: New. PR c++/59096 * g++.dg/cpp0x/gen-attrs-57.C: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205344 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 10 ++++++++++ gcc/cp/pt.c | 8 +++++--- gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/g++.dg/cpp0x/gen-attrs-57.C | 9 +++++++++ gcc/testsuite/g++.dg/cpp0x/initlist75.C | 6 ++++++ 5 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/gen-attrs-57.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist75.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 92b520b45ed..74b75e9891c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,13 @@ +2013-11-25 Paolo Carlini + + PR c++/59080 + * pt.c (unify): Don't call unify_array_domain with a NULL_TREE + third argument. + + PR c++/59096 + * pt.c (apply_late_template_attributes): Check that TREE_VALUE + isn't NULL_TREE in the attribute_takes_identifier_p case. + 2013-11-25 Adam Butcher PR c++/59112 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index b05294bda1b..b58c7556e2e 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -8624,7 +8624,8 @@ apply_late_template_attributes (tree *decl_p, tree attributes, int attr_flags, pass it through tsubst. Attributes like mode, format, cleanup and several target specific attributes expect it unmodified. */ - else if (attribute_takes_identifier_p (get_attribute_name (t))) + else if (attribute_takes_identifier_p (get_attribute_name (t)) + && TREE_VALUE (t)) { tree chain = tsubst_expr (TREE_CHAIN (TREE_VALUE (t)), args, complain, @@ -17210,8 +17211,9 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict, /* Also deduce from the length of the initializer list. */ tree max = size_int (CONSTRUCTOR_NELTS (arg)); tree idx = compute_array_index_type (NULL_TREE, max, tf_none); - return unify_array_domain (tparms, targs, TYPE_DOMAIN (parm), - idx, explain_p); + if (TYPE_DOMAIN (parm) != NULL_TREE) + return unify_array_domain (tparms, targs, TYPE_DOMAIN (parm), + idx, explain_p); } /* If the std::initializer_list deduction worked, replace the diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ddc0fa21167..3459c5142f5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2013-11-25 Paolo Carlini + + PR c++/59080 + * g++.dg/cpp0x/initlist75.C: New. + + PR c++/59096 + * g++.dg/cpp0x/gen-attrs-57.C: New. + 2013-11-25 Adam Butcher PR c++/59112 diff --git a/gcc/testsuite/g++.dg/cpp0x/gen-attrs-57.C b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-57.C new file mode 100644 index 00000000000..12b4f4c84e5 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-57.C @@ -0,0 +1,9 @@ +// PR c++/59096 +// { dg-do compile { target c++11 } } + +template struct A +{ + typedef T B [[mode]]; // { dg-warning "ignored" } +}; + +A::B b; diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist75.C b/gcc/testsuite/g++.dg/cpp0x/initlist75.C new file mode 100644 index 00000000000..f185401c20a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist75.C @@ -0,0 +1,6 @@ +// PR c++/59080 +// { dg-require-effective-target c++11 } + +#include + +auto foo[] = {}; // { dg-error "auto|unable to deduce" } -- 2.11.4.GIT