Commit 58fb06b4 by Nathan Sidwell Committed by Nathan Sidwell

re PR c++/20350 (extern template and struct initializer and specification for a static variable)

cp:
	PR c++/20350
	* decl.c (duplicate_decls): Copy all of DECL_USE_TEMPLATE.
testsuite:
	PR c++/20350
	* g++.dg/template/spec24.C: New.

From-SVN: r100486
parent ccb4e87e
2005-06-02 Nathan Sidwell <nathan@codesourcery.com> 2005-06-02 Nathan Sidwell <nathan@codesourcery.com>
PR c++/20350
* decl.c (duplicate_decls): Copy all of DECL_USE_TEMPLATE.
PR c++/21151 PR c++/21151
* name-lookup.c (pushtag): Push local class even in a template. * name-lookup.c (pushtag): Push local class even in a template.
......
...@@ -1672,13 +1672,14 @@ duplicate_decls (tree newdecl, tree olddecl) ...@@ -1672,13 +1672,14 @@ duplicate_decls (tree newdecl, tree olddecl)
DECL_COMDAT (newdecl) |= DECL_COMDAT (olddecl); DECL_COMDAT (newdecl) |= DECL_COMDAT (olddecl);
DECL_TEMPLATE_INSTANTIATED (newdecl) DECL_TEMPLATE_INSTANTIATED (newdecl)
|= DECL_TEMPLATE_INSTANTIATED (olddecl); |= DECL_TEMPLATE_INSTANTIATED (olddecl);
/* If the OLDDECL is an implicit instantiation, then the NEWDECL
must be too. But, it may not yet be marked as such if the /* If the OLDDECL is an instantiation and/or specialization,
caller has created NEWDECL, but has not yet figured out that then the NEWDECL must be too. But, it may not yet be marked
it is a redeclaration. */ as such if the caller has created NEWDECL, but has not yet
if (DECL_IMPLICIT_INSTANTIATION (olddecl) figured out that it is a redeclaration. */
&& !DECL_USE_TEMPLATE (newdecl)) if (!DECL_USE_TEMPLATE (newdecl))
SET_DECL_IMPLICIT_INSTANTIATION (newdecl); DECL_USE_TEMPLATE (newdecl) = DECL_USE_TEMPLATE (olddecl);
/* Don't really know how much of the language-specific /* Don't really know how much of the language-specific
values we should copy from old to new. */ values we should copy from old to new. */
DECL_IN_AGGR_P (newdecl) = DECL_IN_AGGR_P (olddecl); DECL_IN_AGGR_P (newdecl) = DECL_IN_AGGR_P (olddecl);
......
2005-06-02 Nathan Sidwell <nathan@codesourcery.com> 2005-06-02 Nathan Sidwell <nathan@codesourcery.com>
PR c++/20350
* g++.dg/template/spec24.C: New.
PR c++/21151 PR c++/21151
* g++.dg/pch/local-1.C: New. * g++.dg/pch/local-1.C: New.
* g++.dg/pch/local-1.Hs: New. * g++.dg/pch/local-1.Hs: New.
......
// Copyright (C) 2005 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 1 June 2005 <nathan@codesourcery.com>
// PR 20350: ICE on member specialization with later initialization
// Origin: Carlo Wood carlo@gcc.gnu.org
template <int i> struct Mutex
{
static int mutex;
};
template <int i>
int Mutex<i>::mutex = {1};
template <> int Mutex<0>::mutex;
template <> int Mutex<0>::mutex = 0;
void g()
{
Mutex<0>::mutex = 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment