[Bug c++/28370] [4.2 Regression] undefined reference to template class static variable in an anonymous namespace
------- Comment #8 from pinskia at gcc dot gnu dot org 2006-07-13 14:08 -------
Here is a full reduced self contained testcase:
namespace
{
template< typename Inst>
struct rtl_Instance
{
static int * m_pInstance;
};
template< typename Inst> int * rtl_Instance< Inst>::m_pInstance = 0;
}
int *foo(void)
{
return rtl_Instance<int >::m_pInstance;
}
int main (void)
{
return foo() == 0;
}
--------------------
It is only happens the namespace is anonymous which is why this is 4.2 only
regression. Jason also applied his patch to redhat's 4.1 branch.
Caolan, please next time test against a FSF release of the compiler before
filing a bug because sometimes redhat backports patches to their branch.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |critical
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Keywords| |link-failure
Last reconfirmed|0000-00-00 00:00:00 |2006-07-13 14:08:03
date| |
Summary|undefined reference (to a |[4.2 Regression] undefined
|complicated template |reference to template class
|construct) at link time |static variable in an
| |anonymous namespace
Target Milestone|--- |4.2.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28370
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
Reply to: