Boost logo

Boost :

From: Jason Hise (chaos_at_[hidden])
Date: 2005-05-05 09:13:11


Russell Hind wrote:

> Pavel Vozenilek wrote:
>
>>
>> The library is known to work with several newer compilers,
>> VC7.1 among them. Help with other compilers is welcomed.
>>
>
> I've tried it with bcc32 5.6.4 and just #include <boost/singleton.hpp>
> leads to these errors. If anyone has any ideas on this then I'd be
> happy to try them out.
>
> Cheers
>
> Russell
>
> [C++ Error] dependency_lifetime.hpp(119): E2402 Illegal base class
> type: formal type
> 'leaky_lifetime_ex<CreationFlags,Creator,Lock>::lifetime<Type>'
> resolves to
> 'leaky_lifetime_ex<1,create_using_new,unlocked>::lifetime<Type>'
> [C++ Error] dependency_lifetime.hpp(61): E2402 Illegal base class
> type: formal type 'typename
> leaky_lifetime_ex<CreationFlags,Creator,Lock>::lifetime<Type>::pointer'
> resolves to 'typename
> leaky_lifetime_ex<1,create_using_new,unlocked>::lifetime<Type>::pointer'
> [C++ Error] longevity_registry.hpp(45): E2029
> 'singleton_ex<longevity_registry,dependency_lifetime>' must be a
> previously defined class or struct

The previous line makes me worry that CRTP will not work on your
compiler. CRTP is a major foundation for the library, so if it doesn't
work it may not be possible to find a work around. Does the following
compile?

template < typename Type >
struct Base
{
    Type * ptr;
};

struct Derived : public Base < Derived >
{
};

> [C++ Error] longevity_registry.hpp(80): E2247
> 'longevity_registry::node::longevity' is not accessible
> [C++ Error] longevity_registry.hpp(80): E2247
> 'longevity_registry::node::longevity' is not accessible
> [C++ Error] longevity_registry.hpp(81): E2247
> 'longevity_registry::node::longevity' is not accessible
> [C++ Error] longevity_registry.hpp(81): E2247
> 'longevity_registry::node::longevity' is not accessible
> [C++ Error] longevity_registry.hpp(81): E2247
> 'longevity_registry::node::creation_index' is not accessible
> [C++ Error] longevity_registry.hpp(81): E2247
> 'longevity_registry::node::creation_index' is not accessible
> [C++ Error] longevity_registry.hpp(66): E2288 Pointer to structure
> required on left side of -> or ->*

These might be the result of some compiler problem with friends inside
templated classes. See if this compiles:

template < typename Type >
class Outer
{
private:
    typedef Type some_type;

    class Inner
    {
        typename Outer < Type >::some_type inner;
    } inner;

    friend class Inner;
};

int main ( )
{
    Outer < int > test;
    return 0;
}

-Jason


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk