Salut,
J'utilise Boost 1.43 en partant de :
	
	1 2 3 4 5 6 7 8 9 10 11
   | namespace
{
    struct base
    {
        virtual void method() = 0;
    };
    struct derived : base
    {
        virtual void method() {}
    };
} | 
 Le code suivant ne compile pas :
	
	1 2 3 4 5 6 7 8 9 10 11 12
   | #include <boost/function.hpp>
#include <boost/spirit/home/phoenix.hpp>
#include <boost/spirit/home/phoenix/operator/self.hpp>
 
BOOST_AUTO_TEST_CASE( phoenix_assign_reference_to_pointer )
{
    base* b = 0;
    derived d;
    boost::function< void( base& ) > f( boost::phoenix::ref( b ) = &boost::phoenix::arg_names::arg1 );
    f( d );
    BOOST_CHECK_EQUAL( b, &d );
} | 
 Avec vc80 et vc90 l'erreur est :
	
	C:\Users\Mat\Desktop\dev\include\boost/spirit/home/phoenix/operator/self.hpp(25) : error C2259: '`anonymous-namespace'::base' : cannot instantiate abstract class
 Avec gcc 3.4.4 cygwin :
	
	1 2 3 4 5 6
   |        [cc] C:/Users/Mat/Desktop/dev/include/boost/spirit/home/phoenix/operator/self.hpp: In instantiation of `boost::phoenix::result_of_reference<<unnamed>::base&>':
(blablabla)
       [cc] C:/Users/Mat/Desktop/dev/include/boost/spirit/home/phoenix/operator/self.hpp:25: error: cannot declare variable `boost::phoenix::result_of_reference<<unnamed>::base&>:
x' to be of type `<unnamed>::base'
       [cc] C:/Users/Mat/Desktop/dev/include/boost/spirit/home/phoenix/operator/self.hpp:25: error:   because the following virtual functions are abstract:
(blabla) | 
 A noter que sans passer par la Boost.Fonction f intermédiaire, ça compile et le test passe.
Egalement l'équivalent en Boost.Lambda compile et passe aussi (je peux poster le code éventuellement mais j'imagine qu'on s'en fout :p).
J'ai la berlue ou c'est une sorte de bug ?
Merci !
MAT.
						
					
Partager