aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2014-09-22 12:31:09 -0400
committerJason Merrill <jason@gcc.gnu.org>2014-09-22 12:31:09 -0400
commitaed67566921b2153c5af392ad095e04602aa036f (patch)
tree511d01f3ac904501b9f571501f3d79ac5b19265c /gcc/cp
parentf421c516aa8df5cde8f0310d090562b01967583c (diff)
downloadgcc-aed67566921b2153c5af392ad095e04602aa036f.zip
gcc-aed67566921b2153c5af392ad095e04602aa036f.tar.gz
gcc-aed67566921b2153c5af392ad095e04602aa036f.tar.bz2
decl.c (poplevel): Don't warn about unused vars in template scope.
* decl.c (poplevel): Don't warn about unused vars in template scope. * error.c (dump_decl): Handle variable templates. From-SVN: r215472
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/decl.c1
-rw-r--r--gcc/cp/error.c12
3 files changed, 18 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 857f58d..3dc8c7c 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2014-09-22 Jason Merrill <jason@redhat.com>
+
+ * decl.c (poplevel): Don't warn about unused vars in template scope.
+ * error.c (dump_decl): Handle variable templates.
+
2014-09-20 Jason Merrill <jason@redhat.com>
PR c++/62017
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index fe5a4af..12a9f43 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -624,6 +624,7 @@ poplevel (int keep, int reverse, int functionbody)
/* Before we remove the declarations first check for unused variables. */
if ((warn_unused_variable || warn_unused_but_set_variable)
+ && current_binding_level->kind != sk_template_parms
&& !processing_template_decl)
for (tree d = getdecls (); d; d = TREE_CHAIN (d))
{
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index 86fd405..a03bfe1 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -1044,6 +1044,18 @@ dump_decl (cxx_pretty_printer *pp, tree t, int flags)
case FIELD_DECL:
case PARM_DECL:
dump_simple_decl (pp, t, TREE_TYPE (t), flags);
+
+ /* Handle variable template specializations. */
+ if (TREE_CODE (t) == VAR_DECL
+ && DECL_LANG_SPECIFIC (t)
+ && DECL_TEMPLATE_INFO (t)
+ && PRIMARY_TEMPLATE_P (DECL_TI_TEMPLATE (t)))
+ {
+ pp_cxx_begin_template_argument_list (pp);
+ tree args = INNERMOST_TEMPLATE_ARGS (DECL_TI_ARGS (t));
+ dump_template_argument_list (pp, args, flags);
+ pp_cxx_end_template_argument_list (pp);
+ }
break;
case RESULT_DECL: