Boost logo

Boost :

Subject: Re: [boost] [concept] forward declarations and `BOOST_CONCEPT_REQUIRES()`
From: Stephan T. Lavavej (stl_at_[hidden])
Date: 2010-08-10 21:01:02


Thanks. I've filed this as internal bug number 28784. (It may or may not meet the compiler's triage bar.)

STL

-----Original Message-----
From: boost-bounces_at_[hidden] [mailto:boost-bounces_at_[hidden]] On Behalf Of Stefan van Kessel
Sent: Tuesday, August 10, 2010 5:00 PM
To: boost_at_[hidden]
Subject: Re: [boost] [concept] forward declarations and `BOOST_CONCEPT_REQUIRES()`

On 8/10/2010 11:20 PM, Stephan T. Lavavej wrote:
> (If VC10, aka 1600, is doing something wrong here, I'd like to know about it - with a self-contained repro.)

This is what I think it boils down to:

template <int check>
struct IntToVoid
{
        typedef void type;
};

template <typename T>
struct TypeToZero
{
        enum { value = 0 };
};

template <typename T>
struct Empty
{
};

template<typename T>
typename IntToVoid<(TypeToZero<Empty<T> >::value ) >::type
        foo();

template<typename T>
typename IntToVoid<(TypeToZero<Empty<T> >::value ) >::type
        foo()
{}

int main() {
        foo<int>();

        return 0;
}

1>------ Build started: Project: test, Configuration: Debug x64 ------
1> main.cpp
1>main.cpp(31): error C2668: 'foo' : ambiguous call to overloaded function
1> main.cpp(25): could be 'IntToBool<check>::type foo<int>(void)'
1> with
1> [
1> check=0
1> ]
1> main.cpp(20): or 'IntToBool<check>::type foo<int>(void)'
1> with
1> [
1> check=0
1> ]
1> while trying to match the argument list '(void)'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

If one omits the () around TypeToZero<Empty<T> >::value, it compiles
just fine:

template<typename T>
typename IntToVoid<TypeToZero<Empty<T> >::value >::type
        foo();

template<typename T>
typename IntToVoid<TypeToZero<Empty<T> >::value >::type
        foo() {}

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost


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