Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-11-11 10:07:43


Christoph Ludwig <cludwig_at_[hidden]> writes:

> As I mentioned in previous posts the following code program
>
> #include <boost/type_traits/is_abstract.hpp>
> #include <iostream>
>
> template<typename T>
> struct A { virtual void f() = 0; }
>
> int main() {
> if(boost::is_abstract<A<int> >::value) {
> std::cout << "A<int> is abstract";
> else {
> std::cout << "A<int> is not abstract";
> }
> }
>
> erroneously outputs "A<int> is not abstract" if compiled with gcc 3.4.
>
> However, the regression tests report that gcc 3.4 passes the
> is_abstract test. The reason is that above error is triggered only if
> A<int> is not instantiated by the compiler; but is_abstract_test.cpp
> does not test class template specializations at all.

Why don't we just get is_abstract to cause the instantiation? It
seems to me that you'd need to do that anyway in order to detect
abstractness. As a matter of fact, I have some doubts about your
diagnosis, since I can't imagine any way that is_abstract could work
without doing the instantiation.

-- 
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com

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