Boost logo

Boost :

From: Markus Schöpflin (markus.schoepflin_at_[hidden])
Date: 2007-10-24 09:01:08


Peter Dimov wrote:
> Markus Schöpflin wrote:
>> Hello,
>>
>> as part of its interface intrusive_ptr requires the user to supply two
>> functions:
>>
>> void intrusive_ptr_add_ref(T * p);
>> void intrusive_ptr_release(T * p);
>>
>> These are called from within the implementation of the intrusive_ptr
>> class. When compiling intrusive_ptr_test, cxx complains that
>> intrusive_ptr uses undeclared functions, because the test includes
>> the header file for intrusive_ptr before declaring those two
>> functions.
>
> Are you sure that the compiler is correct? A dependent unqualified call is
> resolved at instantiation time.

Hmm, have a look at this:

---%<---
template <class T> struct foo {
   void bar() { foobar(); }
};

void foobar() {}

void argl() {
   foo<int> f;
   f.bar();
}
--->%---

Comeau Online has this to say:

---%<---
"ComeauTest.c", line 2: error: identifier "foobar" is undefined
     void bar() { foobar(); }
                  ^

1 error detected in the compilation of "ComeauTest.c".
--->%---

What do you think?

Markus


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