On 08/05/2014 04:06 PM, Paolo Carlini wrote:
Great. I will double check but var-templ4.C fails for me with an ICE.
Hunh, I wonder how I missed that.
Here's what I'm checking in; we want to unset DECL_COMDAT for variable
templates, too.
commit b79ecb5928b875ba38b78a3fadb0dd70d6262513
Author: Jason Merrill <ja...@redhat.com>
Date: Wed Aug 6 11:14:55 2014 -0400
* pt.c (check_explicit_specialization): Don't test
DECL_DECLARED_INLINE_P for a variable template.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 57e7216..998ace2 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -2817,9 +2817,11 @@ check_explicit_specialization (tree declarator,
It's just the name of an instantiation. But, it's not
a request for an instantiation, either. */
SET_DECL_IMPLICIT_INSTANTIATION (decl);
- else
+ else if (TREE_CODE (decl) == FUNCTION_DECL)
/* A specialization is not necessarily COMDAT. */
DECL_COMDAT (decl) = DECL_DECLARED_INLINE_P (decl);
+ else if (TREE_CODE (decl) == VAR_DECL)
+ DECL_COMDAT (decl) = false;
/* Register this specialization so that we can find it
again. */