[cfe-dev] DeclarationName for C++ destructor

Sean Hunt scshunt at csclub.uwaterloo.ca
Mon Oct 10 21:48:58 PDT 2011


On Mon, Oct 10, 2011 at 23:40, 章磊 <ioripolo at gmail.com> wrote:

> Hi clang,
>
> After read some code relevant to DeclarationName, i have a little
> problem about it.
>
> For some C++ destructor(compile generated?), the base class (have some
> virtual member) destructor and the derived class destructor have the
> same DeclarationName.
>
> Examples:
>
> class base {
>
>  virtual void foo() const {}
>
> };
>
>
>
> class child: public base {
>
>  void foo() {}
>
> };
>
> if i use LookupPtr to find declarations in the base class with the
> derived class destructor's DeclarationName, i will get the base class
> destructor. Is this expected? If so,  what does this for?
>

That doesn't sound quite right, but in any case, you shouldn't be using name
lookup to find a destructor. Use Sema::LookupDestructor instead.

Sean
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20111011/0dcc9579/attachment.html>


More information about the cfe-dev mailing list