This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch for constexpr variable templates
- From: Braden Obrzut <admin at maniacsvault dot net>
- To: Paolo Carlini <paolo dot carlini at oracle dot com>, Jason Merrill <jason at redhat dot com>
- Cc: Adam Butcher <adam at jessamine dot co dot uk>, Andrew Sutton <andrew dot n dot sutton at gmail dot com>, Ed Smith-Rowland <3dw4rd at verizon dot net>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 06 Aug 2014 07:20:04 -0400
- Subject: Re: Patch for constexpr variable templates
- Authentication-results: sourceware.org; auth=none
- References: <53CCFBEF dot 9080804 at verizon dot net> <53CDD522 dot 9040508 at maniacsvault dot net> <53D172E4 dot 9020902 at redhat dot com> <53D242FD dot 70002 at maniacsvault dot net> <53D2CB20 dot 1090201 at redhat dot com> <53D352F7 dot 7040402 at maniacsvault dot net> <53D3D34A dot 9080009 at redhat dot com> <53D3D3D9 dot 9000102 at redhat dot com> <0d580e6525100d13a49b2c9327c727f8 at imap dot force9 dot net> <CANq5SytLmkHuCF916K_QG31PTovq1Hir5Q76dJmY8Zce76R0Cg at mail dot gmail dot com> <280a4c80527b753476c274f90ab92fa6 at imap dot force9 dot net> <53D5B03D dot 1010300 at maniacsvault dot net> <53D688DE dot 6020001 at redhat dot com> <53D78C0B dot 10701 at maniacsvault dot net> <53D9591B dot 9020402 at redhat dot com> <53D964B3 dot 4070201 at maniacsvault dot net> <53DA3C32 dot 1030600 at redhat dot com> <53DB6A37 dot 3040703 at maniacsvault dot net> <53E121D3 dot 8010209 at redhat dot com> <53E13955 dot 2010307 at oracle dot com> <53E1B1FF dot 5050904 at maniacsvault dot net> <53E1D397 dot 3040306 at oracle dot com>
Here's a patch for the more conservative option.
- Braden Obrzut
2014-08-06 Braden Obrzut <admin@maniacsvault.net>
* pt.c (check_explicit_specialization): Ensure tmpl is a function
template before checking if it is inline for COMDAT.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 57e7216..3bc3961 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -2817,7 +2817,7 @@ 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 (DECL_FUNCTION_TEMPLATE_P (tmpl))
/* A specialization is not necessarily COMDAT. */
DECL_COMDAT (decl) = DECL_DECLARED_INLINE_P (decl);