[spirit] [RC_1_35_0] multiple defined symbols error in static.hpp

Hi, There are linking errors on msvc 7.1 (and probably other compilers) with static.hpp. The structs destructor e default_ctor are defined inside static_ constructors. If I move them to outside the function, they link ok. Regards, -- Felipe Magno de Almeida

Index: core/non_terminal/impl/static.hpp =================================================================== --- core/non_terminal/impl/static.hpp (revisÆo 43915) +++ core/non_terminal/impl/static.hpp (c¢pia de trabalho) @@ -44,25 +44,26 @@ typedef typename boost::call_traits<T>::reference reference; typedef typename boost::call_traits<T>::const_reference const_reference; - static_(Tag = Tag()) + struct destructor { - struct destructor + ~destructor() { - ~destructor() - { - static_::get_address()->~value_type(); - } - }; + static_::get_address()->~value_type(); + } + }; - struct default_ctor + struct default_ctor + { + static void construct() { - static void construct() - { - ::new (static_::get_address()) value_type(); - static destructor d; - } - }; + ::new (static_::get_address()) value_type(); + static destructor d; + } + }; + static_(Tag = Tag()) + { + boost::call_once(&default_ctor::construct, constructed_); } On Fri, Mar 28, 2008 at 5:20 PM, Felipe Magno de Almeida <felipe.m.almeida@gmail.com> wrote:
Hi,
There are linking errors on msvc 7.1 (and probably other compilers) with static.hpp. The structs destructor e default_ctor are defined inside static_ constructors. If I move them to outside the function, they link ok.
Regards, -- Felipe Magno de Almeida
-- Felipe Magno de Almeida

AMDG Felipe Magno de Almeida wrote:
Hi,
There are linking errors on msvc 7.1 (and probably other compilers) with static.hpp. The structs destructor e default_ctor are defined inside static_ constructors. If I move them to outside the function, they link ok.
Compiler bug. msvc 8.0 suffers from it too. In Christ, Steven Watanabe

On Fri, Mar 28, 2008 at 5:31 PM, Steven Watanabe <watanabesj@gmail.com> wrote:
AMDG
Felipe Magno de Almeida wrote:
Hi,
There are linking errors on msvc 7.1 (and probably other compilers) with static.hpp. The structs destructor e default_ctor are defined inside static_ constructors. If I move them to outside the function, they link ok.
Compiler bug. msvc 8.0 suffers from it too.
Locally defined classes have internal linkage? I didn't know. Can this workaround be applied anyway? Hopefully before 1.35.0?
In Christ, Steven Watanabe
Thanks, -- Felipe Magno de Almeida
participants (2)
-
Felipe Magno de Almeida
-
Steven Watanabe