This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: g++ 4.1.1 Missing warning


Stupid, stupid.

While creating a minimal test case, my mistake becomes apparent, so
please disregard. In case you're wondering, adding 'explicit' to the
main Bifilter constructor stops the first parameter in

   Bifilter _bif(new Filter(),Bifilter::DELETE_ON_DESTRUCTION);

being implicitly converted to a Bilfilter& using the first constructor
so that the second (copy) constructor gets called:

    class Bifilter : public Filter
    {
        public:
            enum DestructorAction { DELETE_ON_DESTRUCTION,KEEP_ON_DESTRUCTION };

            explicit Bifilter(
                Filter*          _source = 0,
                Filter*          _sink   = 0,
                DestructorAction _action = KEEP_ON_DESTRUCTION
                );

            Bifilter(
                const Bifilter& _original,
                DestructorAction _action = KEEP_ON_DESTRUCTION
                );
    ...


Tricksy ;)

Andrew Walrond


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]