Boost logo

Boost :

From: Alexander Nasonov (alnsn_at_[hidden])
Date: 2007-01-19 16:22:35


I commited the fix for 1358600 - lexical_cast & pure virtual functions
& VC 8 STL (http://tinyurl.com/yvowz6) for VC++ only but later I
found that Intel 8.1 and Comeau online don't compile as well.

The problem appears in numeric_limits functions. In this usecase,
they return an abstract class by value. Although lexical_cast never
uses those functions, it seems that some compilers do more strick
checking than I thought they should.

For example,

class A
{
public:
    virtual void foo() = 0;
};

template<class T>
struct limits
{
    static int const value = true;
    static T declared_only();
};

int main()
{
    limits<A>::value;
}

fails to compile on VC++ 8, Intel 8.1 and Comeau online at the point
of the declared_only declaration.

However, if I replace a body of A with a declaration (class A;),
those compilers don't complain anymore.
What is this, a compiler bug or my misunderstanding? I remember
that some freedom compiling template code is allowed (and therefore,
some compiler compiles while some others don't) but I don't know
where to search in the standard.

-- 
Alexander Nasonov
http://nasonov.blogspot.com
The wise man does at once what the fool does finally. -- Baltasar
Gracian --
This quote is generated by: 
	/usr/pkg/bin/curl -L http://tinyurl.com/veusy         \
	  | sed -e 's/^document\.write(.//' -e 's/.);$/ --/'  \
	        -e 's/<[^>]*>//g' -e 's/^More quotes from //' \
	  | fmt | tee ~/.signature-quote

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